]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | /// \file push_front.hpp | |
3 | /// Proto callables Fusion push_front | |
4 | // | |
5 | // Copyright 2010 Eric Niebler. Distributed under the Boost | |
6 | // Software License, Version 1.0. (See accompanying file | |
7 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #ifndef BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_FRONT_HPP_EAN_11_27_2010 | |
10 | #define BOOST_PROTO_FUNCTIONAL_FUSION_PUSH_FRONT_HPP_EAN_11_27_2010 | |
11 | ||
12 | #include <boost/type_traits/add_const.hpp> | |
13 | #include <boost/type_traits/remove_const.hpp> | |
14 | #include <boost/type_traits/remove_reference.hpp> | |
15 | #include <boost/fusion/include/push_front.hpp> | |
16 | #include <boost/proto/proto_fwd.hpp> | |
17 | ||
18 | namespace boost { namespace proto { namespace functional | |
19 | { | |
20 | /// \brief A PolymorphicFunctionObject type that invokes the | |
21 | /// \c fusion::push_front() algorithm on its argument. | |
22 | /// | |
23 | /// A PolymorphicFunctionObject type that invokes the | |
24 | /// \c fusion::push_front() algorithm on its argument. | |
25 | struct push_front | |
26 | { | |
27 | BOOST_PROTO_CALLABLE() | |
28 | ||
29 | template<typename Sig> | |
30 | struct result; | |
31 | ||
32 | template<typename This, typename Seq, typename T> | |
33 | struct result<This(Seq, T)> | |
34 | : fusion::result_of::push_front< | |
35 | typename boost::add_const<typename boost::remove_reference<Seq>::type>::type | |
36 | , typename boost::remove_const<typename boost::remove_reference<T>::type>::type | |
37 | > | |
38 | {}; | |
39 | ||
40 | template<typename Seq, typename T> | |
41 | typename fusion::result_of::push_front<Seq const, T>::type | |
42 | operator ()(Seq const &seq, T const &t) const | |
43 | { | |
44 | return fusion::push_front(seq, t); | |
45 | } | |
46 | }; | |
47 | }}} | |
48 | ||
49 | #endif |