Boost logo

Boost Users :

Subject: Re: [Boost-users] [Q] extendig lexical cast with custom classes
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-27 20:36:00


On Sat, Mar 28, 2009 at 1:11 AM, V S P <toreason_at_[hidden]> wrote:

>
> so wanted to know if there is a way to
> extend lexical_cast to support my custom classes
>

Yes, there is. Make your class is serializable to the ostream. lexical_cast
uses std streams (stringstream) for conversion.
Just overload the operator << in your namespace and write out any data to
the stream how you would like it to appear.

Regards,
Ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net