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_SWAP_ACTOR_HPP
9 #define BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP
11 #include <boost/spirit/home/classic/namespace.hpp>
12 #include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
14 namespace boost { namespace spirit {
16 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
18 ///////////////////////////////////////////////////////////////////////////
20 // A semantic action policy that swaps values.
21 // (This doc uses convention available in actors.hpp)
23 // Actions (what it does):
24 // ref.swap( value_ref );
29 // Policy holder, corresponding helper method:
30 // ref_value_actor, swap_a( ref );
31 // ref_const_ref_actor, swap_a( ref, value_ref );
35 // See also ref_value_actor and ref_const_ref_actor for more details.
36 ///////////////////////////////////////////////////////////////////////////
50 : ref(ref_), swap_ref(swap_ref_)
54 void operator()(T2 const& /*val*/) const
60 template<typename IteratorT>
62 IteratorT const& /*first*/,
63 IteratorT const& /*last*/
73 inline swap_actor<T> swap_a(
78 return swap_actor<T>(ref_,swap_ref_);
81 BOOST_SPIRIT_CLASSIC_NAMESPACE_END