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

Side by Side Diff: base/template_util.h

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 1 month 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
« no previous file with comments | « base/task_unittest.cc ('k') | base/template_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <cstddef> // For size_t. 9 #include <cstddef> // For size_t.
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // _Modern C++ Design_ for more details on this sort of trick. 63 // _Modern C++ Design_ for more details on this sort of trick.
64 64
65 struct ConvertHelper { 65 struct ConvertHelper {
66 template <typename To> 66 template <typename To>
67 static YesType Test(To); 67 static YesType Test(To);
68 68
69 template <typename To> 69 template <typename To>
70 static NoType Test(...); 70 static NoType Test(...);
71 71
72 template <typename From> 72 template <typename From>
73 static From Create(); 73 static From& Create();
74 }; 74 };
75 75
76 // Used to determine if a type is a struct/union/class. Inspired by Boost's 76 // Used to determine if a type is a struct/union/class. Inspired by Boost's
77 // is_class type_trait implementation. 77 // is_class type_trait implementation.
78 struct IsClassHelper { 78 struct IsClassHelper {
79 template <typename C> 79 template <typename C>
80 static YesType Test(void(C::*)(void)); 80 static YesType Test(void(C::*)(void));
81 81
82 template <typename C> 82 template <typename C>
83 static NoType Test(...); 83 static NoType Test(...);
(...skipping 16 matching lines...) Expand all
100 template <typename T> 100 template <typename T>
101 struct is_class 101 struct is_class
102 : integral_constant<bool, 102 : integral_constant<bool,
103 sizeof(internal::IsClassHelper::Test<T>(0)) == 103 sizeof(internal::IsClassHelper::Test<T>(0)) ==
104 sizeof(internal::YesType)> { 104 sizeof(internal::YesType)> {
105 }; 105 };
106 106
107 } // namespace base 107 } // namespace base
108 108
109 #endif // BASE_TEMPLATE_UTIL_H_ 109 #endif // BASE_TEMPLATE_UTIL_H_
OLDNEW
« no previous file with comments | « base/task_unittest.cc ('k') | base/template_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698