Skip to content

Instantly share code, notes, and snippets.

@joboccara
Last active January 2, 2018 23:58
Show Gist options
  • Save joboccara/48afd888f2f3cb3e45953ee6a7809861 to your computer and use it in GitHub Desktop.
Save joboccara/48afd888f2f3cb3e45953ee6a7809861 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <boost/spirit/include/karma.hpp>
int main()
{
using namespace boost::spirit::karma;
std::complex<double> c(3, -1);
std::string result;
generate(
std::back_inserter(result), // the output
!double_(0.0) << '(' << double_ << ',' << double_ << ')' //
| // the generator
omit[double_] << double_, //
c.imag(), c.real(), c.imag() // the input
);
std::cout << result << "\n\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment