Skip to content

Instantly share code, notes, and snippets.

@joboccara
Created January 2, 2018 23:59
Show Gist options
  • Save joboccara/b4fb291e68b31d08122dde59417e6928 to your computer and use it in GitHub Desktop.
Save joboccara/b4fb291e68b31d08122dde59417e6928 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <boost/spirit/include/karma.hpp>
int main()
{
using boost::spirit::karma::int_;
using boost::spirit::karma::generate;
std::vector<int> numbers = {5, 3, 2};
std::string result;
generate(
std::back_inserter(result), // the output
int_ << *(", " << int_), // the generator
numbers // 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