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

Revision 857, 1.8 KB checked in by igarcia, 18 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_DECREMENT_ACTOR_HPP
10#define BOOST_SPIRIT_ACTOR_DECREMENT_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 the -- operator on a reference.
19    //  (This doc uses convention available in actors.hpp)
20    //
21    //  Actions:
22    //      --ref;
23    //
24    //  Policy name:
25    //      decrement_action
26    //
27    //  Policy holder, corresponding helper method:
28    //      ref_actor, decrement_a( ref );
29    //
30    //  () operators: both.
31    //
32    //  See also ref_actor for more details.
33    ///////////////////////////////////////////////////////////////////////////
34    struct decrement_action
35    {
36        template<
37            typename T
38        >
39        void act(T& ref_) const
40        {
41            --ref_;
42        }
43    };
44
45    ///////////////////////////////////////////////////////////////////////////
46    // helper method that creates a and_assign_actor.
47    ///////////////////////////////////////////////////////////////////////////
48    template<typename T>
49    inline ref_actor<T,decrement_action> decrement_a(T& ref_)
50    {
51        return ref_actor<T,decrement_action>(ref_);
52    }
53
54}}
55
56#endif
Note: See TracBrowser for help on using the repository browser.