File indexing completed on 2025-01-31 10:01:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
0009 #define BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
0010
0011 #include <boost/spirit/home/classic/namespace.hpp>
0012 #include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
0013 #include <boost/spirit/home/classic/actor/ref_const_ref_actor.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 struct assign_action
0041 {
0042 template<
0043 typename T,
0044 typename ValueT
0045 >
0046 void act(T& ref_, ValueT const& value_) const
0047 {
0048 ref_ = value_;
0049 }
0050 template<
0051 typename T,
0052 typename IteratorT
0053 >
0054 void act(
0055 T& ref_,
0056 IteratorT const& first_,
0057 IteratorT const& last_
0058 ) const
0059 {
0060 typedef T value_type;
0061 #ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
0062 value_type value(first_,last_);
0063 #else
0064 value_type value;
0065 std::copy(first_, last_, std::inserter(value, value.end()));
0066 #endif
0067 ref_ = value;
0068 }
0069 };
0070
0071
0072 template<typename T>
0073 inline ref_value_actor<T,assign_action> assign(T& ref_)
0074 {
0075 return ref_value_actor<T,assign_action>(ref_);
0076 }
0077
0078 template<typename T>
0079 inline ref_value_actor<T,assign_action> assign_a(T& ref_)
0080 {
0081 return ref_value_actor<T,assign_action>(ref_);
0082 }
0083
0084 template<
0085 typename T,
0086 typename ValueT
0087 >
0088 inline ref_const_ref_actor<T,ValueT,assign_action> assign_a(
0089 T& ref_,
0090 ValueT const& value_
0091 )
0092 {
0093 return ref_const_ref_actor<T,ValueT,assign_action>(ref_,value_);
0094 }
0095
0096 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0097
0098 }}
0099
0100 #endif