lundi 20 juillet 2015

Converting std::array of std::string to std::tuple of the same size using boost::lexical_cast

I want to create a function that takes array of strings and converts it to tuple by doing lexical_cast on each of array elements.

std::array size is the same as std::tuple size and all tuple types are known at compile time

For example:

std::tuple<int, double> Result = Convert({"1", "1.0"});

or

int A, B;
std::tie(A, B) = Convert({"1", "2"});

How can I do that with acceptable performace and without c++14 support?

Aucun commentaire:

Enregistrer un commentaire