num_list2.qbk
来自「Boost provides free peer-reviewed portab」· QBK 代码 · 共 31 行
QBK
31 行
[/============================================================================== Copyright (C) 2001-2008 Joel de Guzman Copyright (C) 2001-2008 Hartmut Kaiser Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)===============================================================================/][section Number List - stuffing numbers into a std::vector]This sample demontrates a parser for a comma separated list of numbers. Thenumbers are inserted in a vector using phoenix.[import ../../example/qi/num_list2.cpp][tutorial_numlist2]The full cpp file for this example can be found here: [@../../example/qi/num_list2.cpp]This, again, is the same parser as before. This time, instead of summing up thenumbers, we stuff them in a `std::vector`. `push_back` is supplied by__phoenix__. The expression: push_back(ref(v), _1)appends the parsed number. Like before, `_1` is a __phoenix__ placeholder forthe parsed result attribute. Also, like before, `ref(v)` tells __phoenix__ that`v`, the `std::vector`, is a mutable reference.[endsect]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?