Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ - create new constructor for std::vector<double>?

Tags:

I have written a custom container class which contains a std::vector<double> instance - works nicely. For compatibility with other API's I would like to export the content of the container as a std::vector<double> copy . Currently this works:

MyContainer container;
....
std::vector<double> vc(container.begin(), container.end());

But if possible would like to be able to write:

MyContainer container;
....
std::vector<double> vc(container);

Can I (easily) create such a std::vector<double> constructor?