fork download
  1. #include <string>
  2. #include <vector>
  3. #include <memory>
  4. using namespace std;
  5.  
  6. struct ore : public string {};
  7. static_assert(sizeof(ore) == sizeof(string), "");
  8.  
  9. int main()
  10. {
  11. vector<string> v;
  12. v.emplace_back();
  13.  
  14. auto &&aho = allocator_traits<decltype(v.get_allocator())>::rebind_alloc<ore>{};
  15. v[0].~string();
  16. aho.construct(&v[0]); // expecting SSO.
  17. }
  18.  
Success #stdin #stdout 0s 15224KB
stdin
Standard input is empty
stdout
Standard output is empty