PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://hadesmem.googlecode.com/
C++ Header | 60 lines | 45 code | 8 blank | 7 comment | 1 complexity | 242f2ae2995f14b094f41c882950e9e3 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_EMPTY_09162005_0335)
 8#define FUSION_EMPTY_09162005_0335
 9
10#include <boost/fusion/sequence/intrinsic/size.hpp>
11#include <boost/mpl/bool.hpp>
12#include <boost/fusion/support/tag_of.hpp>
13
14namespace boost { namespace fusion
15{
16    // Special tags:
17    struct sequence_facade_tag;
18    struct mpl_sequence_tag; // mpl sequence tag
19
20    namespace extension
21    {
22        template <typename Tag>
23        struct empty_impl
24        {
25            template <typename Sequence>
26            struct apply 
27                : mpl::bool_<(result_of::size<Sequence>::value == 0)>
28            {};
29        };
30
31        template <>
32        struct empty_impl<sequence_facade_tag>
33        {
34            template <typename Sequence>
35            struct apply : Sequence::template empty<Sequence> {};
36        };
37
38        template <>
39        struct empty_impl<mpl_sequence_tag>;
40    }
41
42    namespace result_of
43    {
44        template <typename Sequence>
45        struct empty 
46            : extension::empty_impl<typename detail::tag_of<Sequence>::type>::
47                template apply<Sequence>
48        {};
49    }
50
51    template <typename Sequence>
52    inline typename result_of::empty<Sequence>::type
53    empty(Sequence const&)
54    {
55        typedef typename result_of::empty<Sequence>::type result;
56        return result();
57    }
58}}
59
60#endif