Does reinterpret_casting std::aligned_storage* to T* without std::launder violate strict-aliasing rules? [duplicate]
问题 This question already has answers here : Does this really break strict-aliasing rules? (2 answers) Closed 2 years ago . The following example comes from std::aligned_storage page of cppreference.com: #include <iostream> #include <type_traits> #include <string> template<class T, std::size_t N> class static_vector { // properly aligned uninitialized storage for N T's typename std::aligned_storage<sizeof(T), alignof(T)>::type data[N]; std::size_t m_size = 0; public: // Create an object in