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

Unified Diff: base/containers/stack_container_unittest.cc

Issue 2932053002: Use C++11 alignment primitives (Closed)
Patch Set: Put back ALIGNAS Created 3 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 side-by-side diff with in-line comments
Download patch
Index: base/containers/stack_container_unittest.cc
diff --git a/base/containers/stack_container_unittest.cc b/base/containers/stack_container_unittest.cc
index 05c733a4a79b4e0f63d9852955877c59dcfbd377..c79e9651d6cce86896951e072a8b88c566fb4bdd 100644
--- a/base/containers/stack_container_unittest.cc
+++ b/base/containers/stack_container_unittest.cc
@@ -7,8 +7,8 @@
#include <stddef.h>
#include <algorithm>
+#include <type_traits>
-#include "base/memory/aligned_memory.h"
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -107,9 +107,9 @@ namespace {
template <size_t alignment>
class AlignedData {
public:
- AlignedData() { memset(data_.void_data(), 0, alignment); }
+ AlignedData() { memset(&data_, 0, alignment); }
~AlignedData() {}
- base::AlignedMemory<alignment, alignment> data_;
+ typename std::aligned_storage<alignment, alignment>::type data_;
danakj 2017/06/12 18:32:10 C++14 adds this (http://en.cppreference.com/w/cpp/
brettw 2017/06/12 22:22:15 I just replaced these all with char arrays. This s
danakj 2017/06/12 22:23:10 Me too, that is A+
};
} // anonymous namespace
@@ -120,11 +120,11 @@ class AlignedData {
TEST(StackContainer, BufferAlignment) {
StackVector<wchar_t, 16> text;
text->push_back(L'A');
- EXPECT_ALIGNED(&text[0], ALIGNOF(wchar_t));
+ EXPECT_ALIGNED(&text[0], alignof(wchar_t));
StackVector<double, 1> doubles;
doubles->push_back(0.0);
- EXPECT_ALIGNED(&doubles[0], ALIGNOF(double));
+ EXPECT_ALIGNED(&doubles[0], alignof(double));
StackVector<AlignedData<16>, 1> aligned16;
aligned16->push_back(AlignedData<16>());

Powered by Google App Engine
This is Rietveld 408576698