From: Balasubramanyam, Shivakumar (sbalasub_at_[hidden])
Date: 2008-04-02 19:18:56


Hi,

 

I need conversion from strings to integers. But the strings could also
be hex numbers.

 

So example is,

 

typedef unsigned long hexType;

 

hexType value;

 

lexical_cast<HexType>("0xAABBCCDD");

 

How do we extend the boost::lexical_cast to support casting user defined
types?

 

I can perform this by specialization but those would need to be in boost
namespace which does not seem to be a recommended way to add
customizations.

 

Thanks,

Shiva