actions.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 69 行
HPP
69 行
// Copyright (c) 2005 Carl Barron. 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)#ifndef ACTIONS_H#define ACTIONS_H#include <boost/spirit/include/phoenix1.hpp>#include <boost/variant.hpp>#include "tag.hpp"struct push_child_impl{ template <class T,class A> struct result {typedef void type;}; template <class T,class A> void operator () (T &list, const A &value) const { typename tag::variant_type p(value); list.push_back(p); }};struct store_in_map_impl{ template <class T,class A> struct result{typedef void type;}; template <class T,class A> void operator () (T &map,const A &value)const { typedef typename T::value_type value_type; map.insert(value_type(value)); }};struct push_back_impl{ template <class T,class A> struct result {typedef void type;}; template <class T,class A> void operator () (T &list,const A &value)const { list.push_back(value); }};struct store_tag_impl{ template <class T,class A,class B,class C> struct result {typedef void type;}; template <class T,class A,class B,class C> void operator ()(T &t,const A &a,const B &b,const C &c)const { t.id = a; t.attributes = b; t.children = c; }};typedef phoenix::function<push_back_impl> push_back_f;typedef phoenix::function<store_in_map_impl>store_in_map_f;typedef phoenix::function<push_child_impl> push_child_f;typedef phoenix::function<store_tag_impl> store_tag_f;#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?