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 3 // found in the LICENSE file. 4 5 #ifndef BASE_TEMPLATE_UTIL_H_ 6 #define BASE_TEMPLATE_UTIL_H_ 7 8 #include <stddef.h> 9 #include <type_traits> 10 11 #include "build/build_config.h" 12 13 namespace base { 14 15 template <class T> struct is_non_const_reference : std::false_type {}; 16 template <class T> struct is_non_const_reference<T&> : std::true_type {}; 17 template <class T> struct is_non_const_reference<const T&> : std::false_type {}; 18 19 namespace internal { 20 21 // Types YesType and NoType are guaranteed such that sizeof(YesType) < 22 // sizeof(NoType). 23 typedef char YesType; 24 25 struct NoType { 26 YesType dummy[2]; 27 }; 28 29 } // namespace internal 30 31 } // namespace base 32 33 #endif // BASE_TEMPLATE_UTIL_H_ 34