#define BOOST_KARMA_NUMERICS_LOOP_UNROLL 0 #include #include #include #include struct X { short x; explicit X(short num = 0) : x(num) {} short getx() const { return x; } void setx(short v) { x = v; } }; BOOST_FUSION_ADAPT_ADT(X, (short, short, obj.getx(), obj.setx(val))) int main() { namespace karma = boost::spirit::karma; X value(-29); std::cout << karma::format(karma::short_, value) << std::endl; }