#include #include class non_copyable { BOOST_MOVABLE_BUT_NOT_COPYABLE(non_copyable) public: non_copyable() {} non_copyable(BOOST_RV_REF(non_copyable)) {} non_copyable& operator=(BOOST_RV_REF(non_copyable)) { return *this; } }; boost::container::vector create1() { return boost::container::vector(); } boost::container::vector create2() { boost::container::vector v; return boost::move(v); } int main() { boost::container::vector v1 = create1(); boost::container::vector v2 = create2(); return 0; }