File indexing completed on 2025-01-31 10:01:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP
0009 #define BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP
0010
0011 #include <boost/spirit/home/classic/namespace.hpp>
0012 #include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
0013 #include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
0014
0015 namespace boost { namespace spirit {
0016
0017 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 struct insert_at_action
0043 {
0044 template<
0045 typename T,
0046 typename ReferentT,
0047 typename ValueT
0048 >
0049 void act(
0050 T& ref_,
0051 ReferentT const& key_,
0052 ValueT const& value_
0053 ) const
0054 {
0055 typedef typename T::value_type value_type;
0056 ref_.insert( value_type(key_, value_) );
0057 }
0058
0059 template<
0060 typename T,
0061 typename ReferentT,
0062 typename IteratorT
0063 >
0064 void act(
0065 T& ref_,
0066 ReferentT const& key_,
0067 IteratorT const& first_,
0068 IteratorT const& last_
0069 ) const
0070 {
0071 typedef typename T::mapped_type mapped_type;
0072 typedef typename T::value_type value_type;
0073
0074 mapped_type value(first_,last_);
0075 value_type key_value(key_, value);
0076 ref_.insert( key_value );
0077 }
0078 };
0079
0080 template<
0081 typename T,
0082 typename ReferentT
0083 >
0084 inline ref_const_ref_value_actor<T,ReferentT,insert_at_action>
0085 insert_at_a(
0086 T& ref_,
0087 ReferentT const& key_
0088 )
0089 {
0090 return ref_const_ref_value_actor<
0091 T,
0092 ReferentT,
0093 insert_at_action
0094 >(ref_,key_);
0095 }
0096
0097 template<
0098 typename T,
0099 typename ReferentT,
0100 typename ValueT
0101 >
0102 inline ref_const_ref_const_ref_actor<T,ReferentT,ValueT,insert_at_action>
0103 insert_at_a(
0104 T& ref_,
0105 ReferentT const& key_,
0106 ValueT const& value_
0107 )
0108 {
0109 return ref_const_ref_const_ref_actor<
0110 T,
0111 ReferentT,
0112 ValueT,
0113 insert_at_action
0114 >(ref_,key_,value_);
0115 }
0116
0117 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0118
0119 }}
0120
0121 #endif