Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: base/template_util.h

Issue 6109007: Unified callback system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: more bits of cleanup Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TEMPLATE_UTIL_H_ 5 #ifndef BASE_TEMPLATE_UTIL_H_
6 #define BASE_TEMPLATE_UTIL_H_ 6 #define BASE_TEMPLATE_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 // template definitions from tr1 13 // template definitions from tr1
14 14
15 template<class T, T v> 15 template<class T, T v>
16 struct integral_constant { 16 struct integral_constant {
17 static const T value = v; 17 static const T value = v;
18 typedef T value_type; 18 typedef T value_type;
19 typedef integral_constant<T, v> type; 19 typedef integral_constant<T, v> type;
20 }; 20 };
21 21
22 template <class T, T v> const T integral_constant<T, v>::value; 22 template <class T, T v> const T integral_constant<T, v>::value;
23 23
24 typedef integral_constant<bool, true> true_type; 24 typedef integral_constant<bool, true> true_type;
25 typedef integral_constant<bool, false> false_type; 25 typedef integral_constant<bool, false> false_type;
26 26
27 template <class T> struct is_pointer : false_type {}; 27 template <class T> struct is_pointer : false_type {};
28 template <class T> struct is_pointer<T*> : true_type {}; 28 template <class T> struct is_pointer<T*> : true_type {};
29 29
30 template<class> struct is_array : public false_type {};
31 template<class T, size_t n> struct is_array<T[n]> : public true_type {};
32 template<class T> struct is_array<T[]> : public true_type {};
33
34 template <class T> struct is_non_const_reference : false_type {};
35 template <class T> struct is_non_const_reference<T&> : true_type {};
36 template <class T> struct is_non_const_reference<const T&> : false_type {};
37
30 namespace internal { 38 namespace internal {
31 39
32 // Types small_ and big_ are guaranteed such that sizeof(small_) < 40 // Types small_ and big_ are guaranteed such that sizeof(small_) <
33 // sizeof(big_) 41 // sizeof(big_)
34 typedef char small_; 42 typedef char small_;
35 43
36 struct big_ { 44 struct big_ {
37 small_ dummy[2]; 45 small_ dummy[2];
38 }; 46 };
39 47
(...skipping 28 matching lines...) Expand all
68 sizeof(internal::ConvertHelper<From, To>::Test( 76 sizeof(internal::ConvertHelper<From, To>::Test(
69 internal::ConvertHelper<From, To>::Create())) 77 internal::ConvertHelper<From, To>::Create()))
70 == sizeof(internal::small_)> { 78 == sizeof(internal::small_)> {
71 }; 79 };
72 80
73 #endif // !defined(OS_WIN) 81 #endif // !defined(OS_WIN)
74 82
75 } // namespace base 83 } // namespace base
76 84
77 #endif // BASE_TEMPLATE_UTIL_H_ 85 #endif // BASE_TEMPLATE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698