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_ERASE_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_ERASE_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 calss the erase method.
22 // (This doc uses convention available in actors.hpp)
24 // Actions (what it does):
25 // ref.erase( value );
26 // ref.erase( T::key_type(first,last) );
27 // ref.erase( key_ref );
32 // Policy holder, corresponding helper method:
33 // ref_value_actor, erase_a( ref );
34 // ref_const_ref_actor, erase_a( ref, key_ref );
38 // See also ref_value_actor and ref_const_ref_actor for more details.
39 ///////////////////////////////////////////////////////////////////////////
46 void act(T& ref_, KeyT const& key_) const
56 IteratorT const& first_,
57 IteratorT const& last_
60 typedef typename T::key_type key_type;
61 key_type key(first_,last_);
68 inline ref_value_actor<T,erase_action> erase_a(T& ref_)
70 return ref_value_actor<T,erase_action>(ref_);
77 inline ref_const_ref_actor<T,KeyT,erase_action> erase_a(
82 return ref_const_ref_actor<T,KeyT,erase_action>(ref_,key_);
85 BOOST_SPIRIT_CLASSIC_NAMESPACE_END