comparison DEPENDENCIES/generic/include/boost/fusion/functional/adapter/fused.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 /*=============================================================================
2 Copyright (c) 2006-2007 Tobias Schwinger
3
4 Use modification and distribution are subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
8
9 #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_HPP_INCLUDED)
10 #define BOOST_FUSION_FUNCTIONAL_ADAPTER_FUSED_HPP_INCLUDED
11
12 #include <boost/type_traits/add_reference.hpp>
13 #include <boost/config.hpp>
14
15 #include <boost/fusion/functional/adapter/detail/access.hpp>
16 #include <boost/fusion/functional/invocation/invoke.hpp>
17
18 #if defined (BOOST_MSVC)
19 # pragma warning(push)
20 # pragma warning (disable: 4512) // assignment operator could not be generated.
21 #endif
22
23 namespace boost { namespace fusion
24 {
25 template <typename Function> class fused;
26
27 //----- ---- --- -- - - - -
28
29 template <typename Function>
30 class fused
31 {
32 Function fnc_transformed;
33
34 typedef typename detail::qf_c<Function>::type & func_const_fwd_t;
35 typedef typename detail::qf<Function>::type & func_fwd_t;
36
37 public:
38
39 inline explicit fused(func_const_fwd_t f = Function())
40 : fnc_transformed(f)
41 { }
42
43 template <class Seq>
44 inline typename result_of::invoke<func_const_fwd_t,Seq const>::type
45 operator()(Seq const & s) const
46 {
47 return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
48 }
49
50 template <class Seq>
51 inline typename result_of::invoke<func_fwd_t,Seq const>::type
52 operator()(Seq const & s)
53 {
54 return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
55 }
56
57 template <class Seq>
58 inline typename result_of::invoke<func_const_fwd_t,Seq>::type
59 operator()(Seq & s) const
60 {
61 return fusion::invoke<func_const_fwd_t>(this->fnc_transformed,s);
62 }
63
64 template <class Seq>
65 inline typename result_of::invoke<func_fwd_t,Seq>::type
66 operator()(Seq & s)
67 {
68 return fusion::invoke<func_fwd_t>(this->fnc_transformed,s);
69 }
70
71 template <typename Sig>
72 struct result;
73
74 template <class Self, class Seq>
75 struct result< Self const (Seq) >
76 : result_of::invoke<func_const_fwd_t,
77 typename boost::remove_reference<Seq>::type >
78 { };
79
80 template <class Self, class Seq>
81 struct result< Self(Seq) >
82 : result_of::invoke<func_fwd_t,
83 typename boost::remove_reference<Seq>::type >
84 { };
85
86 };
87
88 }}
89
90 #if defined (BOOST_MSVC)
91 # pragma warning(pop)
92 #endif
93
94 #endif
95