clang c++17 std::vector over aligned types copy of elements SIGSEGV when compiled with -mavx
- 阅读更多 关于 clang c++17 std::vector over aligned types copy of elements SIGSEGV when compiled with -mavx
问题 According to this question I thought that in C++17 a std::vector with default allocator should handle over aligned types. However, the following code #include <iostream> #include <iterator> #include <array> #include <vector> template<typename T, size_t N, size_t Alignment> struct alignas(Alignment) AlignedArray : public std::array<T, N> { friend std::ostream& operator<<(std::ostream& o, const AlignedArray& a) { std::copy(a.cbegin(), a.cend(), std::ostream_iterator<T>(o, " ")); return o; } };