#include <iostream>
#include <type_traits>   
using namespace std;

// Non-trivially-copyable type.
struct NTC
{
	int x;    	
	NTC(int mX) : x(mX) { }    
	~NTC() { cout << "boop." << x << endl; }
};
        
int main() 
{
	using AS = aligned_storage_t<sizeof(NTC), alignof(NTC)>;
 	
    // Create two `std::aligned_storage` instances
    // and "fill" them with two "placement-new-constructed" 
    // `NTC` instances.
	AS as1, as2;    	
	new (&as1) NTC{2};
	new (&as2) NTC{5};
	    	    
    // Swap the `aligned_storages`, not their contents.
	std::swap(as1, as2);
    
    // Destroy the 
    NTC& in1{*static_cast<NTC*>(static_cast<void*>(&as1))};
	NTC& in2{*static_cast<NTC*>(static_cast<void*>(&as2))};    	
	in1.~NTC();
	in2.~NTC();
	
	return 0;
}