Possible Duplicate:
Can I list-initialize a vector of move-only type?
I've tried this, but get complaints about calling ::std::unique_ptr
's copy constructor. That doesn't seem right. :-(
#include <vector>
#include <memory>
int main()
{
typedef ::std::unique_ptr<int> qint_ptr_t;
::std::vector<qint_ptr_t>{ {new int(5), new int(6) } };
return 0;
}
Is there any way to initialize a vector
of unique_ptr
objects with an initialization list?