| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 static_assert(!internal::SupportsOstreamOperator<SimpleStruct>::value, | 62 static_assert(!internal::SupportsOstreamOperator<SimpleStruct>::value, |
| 63 "simple struct should not be printable by value"); | 63 "simple struct should not be printable by value"); |
| 64 static_assert(!internal::SupportsOstreamOperator<const SimpleStruct&>::value, | 64 static_assert(!internal::SupportsOstreamOperator<const SimpleStruct&>::value, |
| 65 "simple struct should not be printable by const ref"); | 65 "simple struct should not be printable by const ref"); |
| 66 static_assert(internal::SupportsOstreamOperator<StructWithOperator>::value, | 66 static_assert(internal::SupportsOstreamOperator<StructWithOperator>::value, |
| 67 "struct with operator<< should be printable by value"); | 67 "struct with operator<< should be printable by value"); |
| 68 static_assert( | 68 static_assert( |
| 69 internal::SupportsOstreamOperator<const StructWithOperator&>::value, | 69 internal::SupportsOstreamOperator<const StructWithOperator&>::value, |
| 70 "struct with operator<< should be printable by const ref"); | 70 "struct with operator<< should be printable by const ref"); |
| 71 | 71 |
| 72 // underlying type of enums | |
| 73 static_assert(std::is_integral<underlying_type<SimpleEnum>::type>::value, | |
| 74 "simple enum must have some integral type"); | |
| 75 static_assert( | |
| 76 std::is_same<underlying_type<EnumWithExplicitType>::type, uint64_t>::value, | |
| 77 "explicit type must be detected"); | |
| 78 static_assert(std::is_same<underlying_type<ScopedEnum>::type, int>::value, | |
| 79 "scoped enum defaults to int"); | |
| 80 | |
| 81 struct TriviallyDestructible { | 72 struct TriviallyDestructible { |
| 82 int field; | 73 int field; |
| 83 }; | 74 }; |
| 84 | 75 |
| 85 class NonTriviallyDestructible { | 76 class NonTriviallyDestructible { |
| 86 ~NonTriviallyDestructible() {} | 77 ~NonTriviallyDestructible() {} |
| 87 }; | 78 }; |
| 88 | 79 |
| 89 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); | 80 static_assert(is_trivially_destructible<int>::value, "IsTriviallyDestructible"); |
| 90 static_assert(is_trivially_destructible<TriviallyDestructible>::value, | 81 static_assert(is_trivially_destructible<TriviallyDestructible>::value, |
| 91 "IsTriviallyDestructible"); | 82 "IsTriviallyDestructible"); |
| 92 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, | 83 static_assert(!is_trivially_destructible<NonTriviallyDestructible>::value, |
| 93 "IsTriviallyDestructible"); | 84 "IsTriviallyDestructible"); |
| 94 | 85 |
| 95 } // namespace | 86 } // namespace |
| 96 } // namespace base | 87 } // namespace base |
| OLD | NEW |