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

Side by Side Diff: base/template_util.h

Issue 2944523002: Improving flat containers interface. (Closed)
Patch Set: Review, round 4. Created 3 years, 5 months 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
« base/functional_unittest.cc ('K') | « base/functional_unittest.cc ('k') | no next file » | 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 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <type_traits> 10 #include <type_traits>
(...skipping 24 matching lines...) Expand all
35 #endif 35 #endif
36 36
37 namespace base { 37 namespace base {
38 38
39 template <class T> struct is_non_const_reference : std::false_type {}; 39 template <class T> struct is_non_const_reference : std::false_type {};
40 template <class T> struct is_non_const_reference<T&> : std::true_type {}; 40 template <class T> struct is_non_const_reference<T&> : std::true_type {};
41 template <class T> struct is_non_const_reference<const T&> : std::false_type {}; 41 template <class T> struct is_non_const_reference<const T&> : std::false_type {};
42 42
43 namespace internal { 43 namespace internal {
44 44
45 template <typename...>
46 struct make_void {
47 using type = void;
48 };
49
50 // A clone of C++17 std::void_t.
51 // Unlike the original version, we need |make_void| as a helper struct to avoid
52 // a C++14 defect.
53 // ref: http://en.cppreference.com/w/cpp/types/void_t
54 // ref: http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558
55 template <typename... Ts>
56 using void_t = typename make_void<Ts...>::type;
57
45 // Uses expression SFINAE to detect whether using operator<< would work. 58 // Uses expression SFINAE to detect whether using operator<< would work.
46 template <typename T, typename = void> 59 template <typename T, typename = void>
47 struct SupportsOstreamOperator : std::false_type {}; 60 struct SupportsOstreamOperator : std::false_type {};
48 template <typename T> 61 template <typename T>
49 struct SupportsOstreamOperator<T, 62 struct SupportsOstreamOperator<T,
50 decltype(void(std::declval<std::ostream&>() 63 decltype(void(std::declval<std::ostream&>()
51 << std::declval<T>()))> 64 << std::declval<T>()))>
52 : std::true_type {}; 65 : std::true_type {};
53 66
54 } // namespace internal 67 } // namespace internal
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 template <class T> 107 template <class T>
95 using is_trivially_copyable = std::is_trivially_copyable<T>; 108 using is_trivially_copyable = std::is_trivially_copyable<T>;
96 #endif 109 #endif
97 110
98 } // namespace base 111 } // namespace base
99 112
100 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 113 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
101 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 114 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
102 115
103 #endif // BASE_TEMPLATE_UTIL_H_ 116 #endif // BASE_TEMPLATE_UTIL_H_
OLDNEW
« base/functional_unittest.cc ('K') | « base/functional_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698