Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-24 10:21:31


> Why not use boost::lexical_cast<std::string>(something_to_convert)?

1)

#include <boost/lexical_cast.hpp>
#include <string>
#include <iostream>

int main()
{
    std::cout << boost::lexical_cast<std::string>("this is a test");
}

2) to_string() is the established, novice-friendly name for this idiom; even
with a working lexical_cast, I'd prefer to_string when I want to_string
behavior since it leaves less room for errors.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk