PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/fusion/sequence/intrinsic/back.hpp

http://hadesmem.googlecode.com/
C++ Header | 42 lines | 30 code | 6 blank | 6 comment | 0 complexity | a67d6a1aaf61523546efde80ef82af0a MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2006 Joel de Guzman
 3
 4    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 5    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 6==============================================================================*/
 7#if !defined(FUSION_BACK_09162005_0350)
 8#define FUSION_BACK_09162005_0350
 9
10#include <boost/fusion/sequence/intrinsic/end.hpp>
11#include <boost/fusion/iterator/prior.hpp>
12#include <boost/fusion/iterator/deref.hpp>
13#include <boost/mpl/bool.hpp>
14
15namespace boost { namespace fusion
16{
17    struct fusion_sequence_tag;
18
19    namespace result_of
20    {
21        template <typename Sequence>
22        struct back
23            : result_of::deref<typename result_of::prior<typename result_of::end<Sequence>::type>::type>
24        {};
25    }
26    
27    template <typename Sequence>
28    inline typename result_of::back<Sequence>::type
29    back(Sequence& seq)
30    {
31        return *fusion::prior(fusion::end(seq));
32    }
33
34    template <typename Sequence>
35    inline typename result_of::back<Sequence const>::type
36    back(Sequence const& seq)
37    {
38        return *fusion::prior(fusion::end(seq));
39    }
40}}
41
42#endif