MCPcopy Create free account
hub / github.com/boostorg/spirit / generate_complex

Function generate_complex

example/karma/complex_number.cpp:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 //[tutorial_karma_complex_number
60 template <typename OutputIterator>
61 bool generate_complex(OutputIterator sink, std::complex<double> const& c)
62 {
63 using boost::spirit::karma::eps;
64 using boost::spirit::karma::double_;
65 using boost::spirit::karma::_1;
66 using boost::spirit::karma::generate;
67
68 return generate(sink,
69 // Begin grammar
70 (
71 eps(c.imag() != 0) <<
72 '(' << double_[_1 = c.real()] << ", " << double_[_1 = c.imag()] << ')'
73 | double_[_1 = c.real()]
74 )
75 // End grammar
76 );
77 }
78 //]
79}
80

Callers 1

mainFunction · 0.70

Calls 1

generateFunction · 0.70

Tested by

no test coverage detected