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

Side by Side Diff: base/template_util_unittest.cc

Issue 2000043002: Make base::Optional trivially destructible when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build on Windows. Created 4 years, 6 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
« no previous file with comments | « base/template_util.h ('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) 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
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
OLDNEW
« no previous file with comments | « base/template_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698