]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | : public std::binary_function<_Ty, _Tz, _Ty> | |
22 | { | |
23 | // functor for operator+ | |
24 | _Ty operator()( _Ty _Left, _Tz _Right) const | |
25 | { | |
26 | // apply operator+ to operands | |
27 | return (_Left + _Right); | |
28 | } | |
29 | }; | |
30 | // helper to dereference a pointer to a function pointer | |
31 | template <class T> | |
32 | struct deref | |
33 | { | |
34 | typedef T& result_type; | |
35 | T& operator()(T* f) const | |
36 | { | |
37 | return *f; | |
38 | } | |
39 | }; | |
40 | } } }//boost::msm::back | |
41 | #endif //BOOST_MSM_BACK_BIND_HELPERS_H |