source: NonGTP/Boost/boost/spirit/actor/clear_actor.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3    http://spirit.sourceforge.net/
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8=============================================================================*/
9#ifndef BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP
10#define BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP
11
12#include <boost/spirit/actor/ref_actor.hpp>
13
14namespace boost { namespace spirit {
15
16    ///////////////////////////////////////////////////////////////////////////
17    //  Summary:
18    //  A semantic action policy that calls clear method.
19    //  (This doc uses convention available in actors.hpp)
20    //
21    //  Actions (what it does):
22    //      ref.clear();
23    //
24    //  Policy name:
25    //      clear_action
26    //
27    //  Policy holder, corresponding helper method:
28    //      ref_actor, clear_a( ref );
29    //
30    //  () operators: both.
31    //
32    //  See also ref_actor for more details.
33    ///////////////////////////////////////////////////////////////////////////
34    struct clear_action
35    {
36        template<
37            typename T
38        >
39        void act(T& ref_) const
40        {
41            ref_.clear();
42        }
43    };
44
45    ///////////////////////////////////////////////////////////////////////////
46    // helper method that creates a and_assign_actor.
47    ///////////////////////////////////////////////////////////////////////////
48    template<typename T>
49    inline ref_actor<T,clear_action> clear_a(T& ref_)
50    {
51        return ref_actor<T,clear_action>(ref_);
52    }
53
54
55}}
56
57#endif
58
Note: See TracBrowser for help on using the repository browser.