mirror of
https://github.com/boostorg/conversion.git
synced 2026-01-26 17:02:33 +01:00
lexical_cast.hpp improvements: fix bug with floats conversions and improve docs (refs #9046)
[SVN r85852]
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user