Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 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 | |
Alex Vakulenko | 674f0eb | 2016-01-20 08:10:48 -0800 | [diff] [blame] | 8 | #include <stddef.h> |
Vitaly Buka | 8750b27 | 2015-08-18 18:39:08 -0700 | [diff] [blame] | 9 | #include <type_traits> |
Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 10 | |
Alex Vakulenko | f1fa8be | 2015-12-08 12:38:56 -0800 | [diff] [blame] | 11 | #include "build/build_config.h" |
Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 12 | |
| 13 | namespace base { |
| 14 | |
Vitaly Buka | 8750b27 | 2015-08-18 18:39:08 -0700 | [diff] [blame] | 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 {}; |
Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 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 | |
Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 29 | } // namespace internal |
| 30 | |
Vitaly Buka | cbed206 | 2015-08-17 12:54:05 -0700 | [diff] [blame] | 31 | } // namespace base |
| 32 | |
| 33 | #endif // BASE_TEMPLATE_UTIL_H_ |