jeudi 1 juin 2017

Create a type which exhibits exact same behavior as STL container std::set

I have following typedefs :

typedef std::pair<std::string, std::string> iprange;
typedef std::set<iprange> iprange_set;

When I try to write lexical_cast around iprange and iprange_set with some other types such as Json::Value or std:string compiler is giving error since a typedef is just an alias not a real type, so it can't be overloaded.

is there a way to have a type that exhibit the properties of existing type without typedef ?

The result I am looking for is that I should be able to declare variables using that type and also use it as parameter in boost::lexical_cast

Aucun commentaire:

Enregistrer un commentaire