PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/classic/actor/increment_actor.hpp

http://hadesmem.googlecode.com/
C++ Header | 60 lines | 24 code | 8 blank | 28 comment | 0 complexity | f466683e4aa136cf5eee6cd2dfb51b96 MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
 3    http://spirit.sourceforge.net/
 4
 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_INCREMENT_ACTOR_HPP
 9#define BOOST_SPIRIT_ACTOR_INCREMENT_ACTOR_HPP
10
11#include <boost/spirit/home/classic/namespace.hpp>
12#include <boost/spirit/home/classic/actor/ref_actor.hpp>
13
14namespace boost { namespace spirit {
15
16BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
17
18    ///////////////////////////////////////////////////////////////////////////
19    //  Summary:
20    //  A semantic action policy that calls the ++ operator on a reference.
21    //  (This doc uses convention available in actors.hpp)
22    //
23    //  Actions:
24    //      ++ref;
25    //
26    //  Policy name:
27    //      increment_action
28    //
29    //  Policy holder, corresponding helper method:
30    //      ref_actor, increment_a( ref );
31    //
32    //  () operators: both.
33    //
34    //  See also ref_actor for more details.
35    ///////////////////////////////////////////////////////////////////////////
36    struct increment_action
37    {
38        template<
39            typename T
40        >
41        void act(T& ref_) const
42        {
43            ++ref_;
44        }
45    };
46
47    ///////////////////////////////////////////////////////////////////////////
48    // helper method that creates a increment_actor.
49    ///////////////////////////////////////////////////////////////////////////
50    template<typename T>
51    inline ref_actor<T,increment_action> increment_a(T& ref_)
52    {
53        return ref_actor<T,increment_action>(ref_);
54    }
55
56BOOST_SPIRIT_CLASSIC_NAMESPACE_END
57
58}}
59
60#endif