blob: 7b61d2437a0ee30247bf0fc2a02e20efc7099f7f [file] [log] [blame]
Vitaly Bukacbed2062015-08-17 12:54:05 -07001// 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 Vakulenko674f0eb2016-01-20 08:10:48 -08008#include <stddef.h>
Vitaly Buka8750b272015-08-18 18:39:08 -07009#include <type_traits>
Vitaly Bukacbed2062015-08-17 12:54:05 -070010
Alex Vakulenkof1fa8be2015-12-08 12:38:56 -080011#include "build/build_config.h"
Vitaly Bukacbed2062015-08-17 12:54:05 -070012
13namespace base {
14
Vitaly Buka8750b272015-08-18 18:39:08 -070015template <class T> struct is_non_const_reference : std::false_type {};
16template <class T> struct is_non_const_reference<T&> : std::true_type {};
17template <class T> struct is_non_const_reference<const T&> : std::false_type {};
Vitaly Bukacbed2062015-08-17 12:54:05 -070018
19namespace internal {
20
21// Types YesType and NoType are guaranteed such that sizeof(YesType) <
22// sizeof(NoType).
23typedef char YesType;
24
25struct NoType {
26 YesType dummy[2];
27};
28
Vitaly Bukacbed2062015-08-17 12:54:05 -070029} // namespace internal
30
Vitaly Bukacbed2062015-08-17 12:54:05 -070031} // namespace base
32
33#endif // BASE_TEMPLATE_UTIL_H_