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

Function main

example/qi/boost_array.cpp:98–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}}}
97
98int main()
99{
100 typedef std::string::const_iterator iterator_type;
101 typedef boost::array<int, 2> array_type;
102 typedef client::result_of::adapt_array<array_type>::type adapted_type;
103
104 array_type arr;
105
106 std::string str = "1 2";
107 iterator_type iter = str.begin();
108 iterator_type end = str.end();
109
110 qi::rule<iterator_type, adapted_type(), ascii::space_type> r = *qi::int_;
111
112 adapted_type attr = client::adapt_array(arr);
113 bool result = qi::phrase_parse(iter, end, r, ascii::space, attr);
114
115 if (result)
116 std::cout << "Parsed: " << arr[0] << ", " << arr[1] << std::endl;
117
118 return 0;
119}

Callers

nothing calls this directly

Calls 4

adapt_arrayFunction · 0.70
phrase_parseFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected