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_ASSIGN_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
11 #include <boost/spirit/home/classic/namespace.hpp>
12 #include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
13 #include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
15 namespace boost { namespace spirit {
17 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
19 ///////////////////////////////////////////////////////////////////////////
21 // A semantic action policy that applies the assignement operator.
22 // (This doc uses convention available in actors.hpp)
24 // Actions (what it does):
26 // ref = T(first,last);
32 // Policy holder, corresponding helper method:
33 // ref_value_actor, assign_a( ref );
34 // ref_const_ref_actor, assign_a( ref, value_ref );
38 // See also ref_value_actor and ref_const_ref_actor for more details.
39 ///////////////////////////////////////////////////////////////////////////
46 void act(T& ref_, ValueT const& value_) const
56 IteratorT const& first_,
57 IteratorT const& last_
61 #ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
62 value_type value(first_,last_);
65 std::copy(first_, last_, std::inserter(value, value.end()));
71 // Deprecated. Please use assign_a
73 inline ref_value_actor<T,assign_action> assign(T& ref_)
75 return ref_value_actor<T,assign_action>(ref_);
79 inline ref_value_actor<T,assign_action> assign_a(T& ref_)
81 return ref_value_actor<T,assign_action>(ref_);
88 inline ref_const_ref_actor<T,ValueT,assign_action> assign_a(
93 return ref_const_ref_actor<T,ValueT,assign_action>(ref_,value_);
96 BOOST_SPIRIT_CLASSIC_NAMESPACE_END