PageRenderTime 29ms CodeModel.GetById 18ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/proto/functional/fusion/pop_back.hpp

http://hadesmem.googlecode.com/
C++ Header | 60 lines | 38 code | 9 blank | 13 comment | 0 complexity | d462c14a23f0225d565fc4f21b230255 MD5 | raw file
 1///////////////////////////////////////////////////////////////////////////////
 2/// \file pop_back.hpp
 3/// Proto callables Fusion pop_back
 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_POP_BACK_HPP_EAN_11_27_2010
10#define BOOST_PROTO_FUNCTIONAL_FUSION_POP_BACK_HPP_EAN_11_27_2010
11
12#include <boost/fusion/include/begin.hpp>
13#include <boost/fusion/include/end.hpp>
14#include <boost/fusion/include/prior.hpp>
15#include <boost/fusion/include/pop_back.hpp>
16#include <boost/proto/proto_fwd.hpp>
17
18namespace boost { namespace proto { namespace functional
19{
20    /// \brief A PolymorphicFunctionObject type that invokes the
21    /// \c fusion::pop_back() algorithm on its argument.
22    ///
23    /// A PolymorphicFunctionObject type that invokes the
24    /// \c fusion::pop_back() algorithm on its argument.
25    struct pop_back
26    {
27        BOOST_PROTO_CALLABLE()
28
29        template<typename Sig>
30        struct result;
31
32        template<typename This, typename Seq>
33        struct result<This(Seq)>
34          : result<This(Seq const &)>
35        {};
36
37        template<typename This, typename Seq>
38        struct result<This(Seq &)>
39          : fusion::result_of::pop_back<Seq>
40        {};
41
42        template<typename Seq>
43        typename fusion::result_of::pop_back<Seq>::type
44        operator ()(Seq &seq) const
45        {
46            // Work around a const-correctness issue in Fusion
47            typedef typename fusion::result_of::pop_back<Seq>::type result_type;
48            return result_type(fusion::begin(seq), fusion::prior(fusion::end(seq)));
49        }
50
51        template<typename Seq>
52        typename fusion::result_of::pop_back<Seq const>::type
53        operator ()(Seq const &seq) const
54        {
55            return fusion::pop_back(seq);
56        }
57    };
58}}}
59
60#endif