1 /*=============================================================================
2 Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3 http://spirit.sourceforge.net/
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 #ifndef BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP
11 #include <boost/spirit/home/classic/namespace.hpp>
12 #include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
14 namespace boost { namespace spirit {
16 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
18 ///////////////////////////////////////////////////////////////////////////
20 // A semantic action policy that insert data into an associative
21 // container using a const reference to data.
22 // (This doc uses convention available in actors.hpp)
24 // Actions (what it does):
25 // ref.insert( T::value_type(value,value_ref) );
26 // ref.insert( T::value_type(T::key_type(first,last), value_ref));;
31 // Policy holder, corresponding helper method:
32 // ref_const_ref_value_actor, insert_key_a( ref, value_ref );
36 // See also ref_const_ref_value_actor for more details.
37 ///////////////////////////////////////////////////////////////////////////
38 struct insert_key_action
51 typedef typename T::value_type value_type;
52 value_type key_value(key_, value_);
53 ref_.insert( key_value );
64 IteratorT const& first_,
65 IteratorT const& last_
68 typedef typename T::key_type key_type;
69 typedef typename T::value_type value_type;
71 key_type key(first_,last_);
72 value_type key_value(key, value_);
73 ref_.insert( key_value );
81 inline ref_const_ref_value_actor<T,ValueT,insert_key_action> insert_key_a(
86 return ref_const_ref_value_actor<
93 BOOST_SPIRIT_CLASSIC_NAMESPACE_END