1[/============================================================================== 2 Copyright (C) 2001-2011 Joel de Guzman 3 Copyright (C) 2001-2011 Hartmut Kaiser 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7===============================================================================/] 8 9[section Number List - stuffing numbers into a std::vector] 10 11This sample demonstrates a parser for a comma separated list of numbers. The 12numbers are inserted in a vector using phoenix. 13 14[import ../../example/qi/num_list2.cpp] 15 16[tutorial_numlist2] 17 18The full cpp file for this example can be found here: [@../../example/qi/num_list2.cpp] 19 20This, again, is the same parser as before. This time, instead of summing up the 21numbers, we stuff them in a `std::vector`. `push_back` is supplied by 22__phoenix__. The expression: 23 24 push_back(ref(v), _1) 25 26appends the parsed number. Like before, `_1` is a __phoenix__ placeholder for 27the parsed result attribute. Also, like before, `ref(v)` tells __phoenix__ that 28`v`, the `std::vector`, is a mutable reference. 29 30[endsect] 31