| 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 |
|
|---|
| 8 | struct 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 |
|
|---|
| 17 | BOOST_FUSION_ADAPT_ADT(X, (short, short, obj.getx(), obj.setx(val)))
|
|---|
| 18 |
|
|---|
| 19 | int main()
|
|---|
| 20 | {
|
|---|
| 21 | namespace karma = boost::spirit::karma;
|
|---|
| 22 |
|
|---|
| 23 | X value(-29);
|
|---|
| 24 | std::cout << karma::format(karma::short_, value) << std::endl;
|
|---|
| 25 | }
|
|---|