1 [/==============================================================================
2 Copyright (C) 2001-2011 Joel de Guzman
3 Copyright (C) 2001-2011 Hartmut Kaiser
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 ===============================================================================/]
9 [section Number List - stuffing numbers into a std::vector]
11 This sample demonstrates a parser for a comma separated list of numbers. The
12 numbers are inserted in a vector using phoenix.
14 [import ../../example/qi/num_list2.cpp]
18 The full cpp file for this example can be found here: [@../../example/qi/num_list2.cpp]
20 This, again, is the same parser as before. This time, instead of summing up the
21 numbers, we stuff them in a `std::vector`. `push_back` is supplied by
22 __phoenix__. The expression:
26 appends the parsed number. Like before, `_1` is a __phoenix__ placeholder for
27 the parsed result attribute. Also, like before, `ref(v)` tells __phoenix__ that
28 `v`, the `std::vector`, is a mutable reference.