Language
C++
Compiler
gcc 8.2.0
Options
Warnings
Boost 1.68.0
C++2a(GNU)
no pedantic
#include <fstream>
#include <iostream>
#include <vector>
#define BOOST_SPIRIT_USE_PHOENIX_V3
#include <boost/fusion/adapted/struct.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
namespace qi = boost::spirit::qi;
namespace px = boost::phoenix;
struct varVec
{
std::vector<unsigned int> uintVec;
};
BOOST_FUSION_ADAPT_STRUCT(varVec,
(std::vector<unsigned int>, uintVec))
template<typename Iterator, typename Skipper>
struct listParser : public qi::grammar<Iterator,
varVec(),
Skipper>
{
listParser() : listParser::base_type(varVecParse)
{
using namespace qi;
qi::_1_type const upper;
qi::_a_type const lower;
px::local_names::_i_type const cont;
varPair =
uint_ [lower = _1]
> '-'
> uint_
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.68.0/gcc-8.2.0/include -std=gnu++2a
i = 4
i = 5
i = 6
size = 3
val = 4
Exit Code:
0