lexical_cast.hpp improvements: fix bug with floats conversions and improve docs (refs #9046)

[SVN r85852]
This commit is contained in:
Antony Polukhin
2013-09-23 11:59:06 +00:00
parent ce7a54af7f
commit 701963d3c4
2 changed files with 30 additions and 29 deletions

View File

@@ -44,16 +44,19 @@ std::string stringize(const Sequence& seq) {
}
//` Step 3: Using the `stringize` with different types:
#include <iostream>
#include <cassert>
#include <boost/fusion/adapted/boost_tuple.hpp>
#include <boost/fusion/adapted/std_pair.hpp>
int main() {
boost::tuple<char, int, char, int> decim('-', 10, 'e', 5);
std::pair<short, std::string> value_and_type(270, "Kelvin");
assert(stringize(decim) == "-10e5");
std::cout << stringize(decim) << '\n' // outputs '-10e5'
<< stringize(value_and_type); // outputs '270Kelvin'
std::pair<short, std::string> value_and_type(270, "Kelvin");
assert(stringize(value_and_type) == "270Kelvin");
}
//] [/lexical_cast_stringize]