Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / msm / back / bind_helpers.hpp
1 // Copyright 2008 Christophe Henry
2 // henry UNDERSCORE christophe AT hotmail DOT com
3 // This is an extended version of the state machine available in the boost::mpl library
4 // Distributed under the same license as the original.
5 // Copyright for the original version:
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
7 // under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_MSM_BACK_BIND_HELPERS_H
12 #define BOOST_MSM_BACK_BIND_HELPERS_H
13
14 #include <functional>
15
16 namespace boost { namespace msm { namespace back
17 {
18     // helper to replace std::plus as the lack of implicit conversion makes it not usable in one of our bind
19     template<class _Ty,class _Tz>
20     struct plus2
21     {
22         typedef _Ty first_argument_type;
23         typedef _Tz second_argument_type;
24         typedef _Ty result_type;
25
26         // functor for operator+
27         _Ty operator()( _Ty _Left, _Tz _Right) const
28         {
29             // apply operator+ to operands
30             return (_Left + _Right);
31         }
32     };
33     // helper to dereference a pointer to a function pointer
34     template <class T>
35     struct deref 
36     {
37         typedef T& result_type;
38         T& operator()(T*  f) const
39         {
40             return *f;
41         }
42     };
43 } } }//boost::msm::back
44 #endif //BOOST_MSM_BACK_BIND_HELPERS_H