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