diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-26 16:22:50 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-26 16:22:50 +0000 |
commit | 6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375 (patch) | |
tree | 1062e8ae71f9d3a15421809847e6b0208bde8ad0 /base/template_util.h | |
parent | e93fd55e815c0004672e0a7621fcd617b8196035 (diff) | |
download | chromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.zip chromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.tar.gz chromium_src-6a341fbb4fa4651ea5d60ce8aa57e5fabe3da375.tar.bz2 |
Add COMPILE_ASSERT to ensure the result of Bind matches the Callback's type.
Required because we abstract the storage of the funciton pointer out using
a reinterpret_cast to reduce template bloat. This effectively readds the
failure that would have happened had we stored the function pointer directly
in the template class.
BUG=86008
TEST=new unittests.
Review URL: http://codereview.chromium.org/7241015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/template_util.h')
-rw-r--r-- | base/template_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/base/template_util.h b/base/template_util.h index 66e6a61..f19fb4b 100644 --- a/base/template_util.h +++ b/base/template_util.h @@ -29,6 +29,9 @@ typedef integral_constant<bool, false> false_type; template <class T> struct is_pointer : false_type {}; template <class T> struct is_pointer<T*> : true_type {}; +template <class T, class U> struct is_same : public false_type {}; +template <class T> struct is_same<T,T> : true_type {}; + template<class> struct is_array : public false_type {}; template<class T, size_t n> struct is_array<T[n]> : public true_type {}; template<class T> struct is_array<T[]> : public true_type {}; |