OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/template_util.h" | 5 #include "base/template_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // underlying type of enums | 105 // underlying type of enums |
106 static_assert(std::is_integral<underlying_type<SimpleEnum>::type>::value, | 106 static_assert(std::is_integral<underlying_type<SimpleEnum>::type>::value, |
107 "simple enum must have some integral type"); | 107 "simple enum must have some integral type"); |
108 static_assert( | 108 static_assert( |
109 std::is_same<underlying_type<EnumWithExplicitType>::type, uint64_t>::value, | 109 std::is_same<underlying_type<EnumWithExplicitType>::type, uint64_t>::value, |
110 "explicit type must be detected"); | 110 "explicit type must be detected"); |
111 static_assert(std::is_same<underlying_type<ScopedEnum>::type, int>::value, | 111 static_assert(std::is_same<underlying_type<ScopedEnum>::type, int>::value, |
112 "scoped enum defaults to int"); | 112 "scoped enum defaults to int"); |
113 | 113 |
| 114 struct TriviallyDestructible { |
| 115 int field; |
| 116 }; |
| 117 |
| 118 class NonTriviallyDestructible { |
| 119 ~NonTriviallyDestructible() {} |
| 120 }; |
| 121 |
| 122 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); |
| 123 static_assert(is_trivially_destructible<TriviallyDestructible>::value, |
| 124 "IsTriviallyDestructible"); |
| 125 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, |
| 126 "IsTriviallyDestructible"); |
| 127 |
114 } // namespace | 128 } // namespace |
115 } // namespace base | 129 } // namespace base |
OLD | NEW |