Ticket #6126: test_short_output_with_karma.cpp

File test_short_output_with_karma.cpp, 606 bytes (added by bugs@…, 11 years ago)

Further reduced test case

Line 
1#define BOOST_KARMA_NUMERICS_LOOP_UNROLL 0
2#include <boost/fusion/include/adapt_adt.hpp>
3#include <boost/spirit/include/support_adapt_adt_attributes.hpp>
4
5#include <boost/fusion/include/adapt_struct.hpp>
6#include <boost/spirit/include/karma.hpp>
7
8struct X
9{
10 short x;
11
12 explicit X(short num = 0) : x(num) {}
13 short getx() const { return x; }
14 void setx(short v) { x = v; }
15};
16
17BOOST_FUSION_ADAPT_ADT(X, (short, short, obj.getx(), obj.setx(val)))
18
19int main()
20{
21 namespace karma = boost::spirit::karma;
22
23 X value(-29);
24 std::cout << karma::format(karma::short_, value) << std::endl;
25}