comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/empty.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) 2001-2011 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_fwd.hpp>
11 #include <boost/fusion/sequence/intrinsic/size.hpp>
12 #include <boost/mpl/bool.hpp>
13 #include <boost/fusion/support/tag_of.hpp>
14
15 namespace boost { namespace fusion
16 {
17 // Special tags:
18 struct sequence_facade_tag;
19 struct mpl_sequence_tag; // mpl sequence tag
20
21 namespace extension
22 {
23 template <typename Tag>
24 struct empty_impl
25 {
26 template <typename Sequence>
27 struct apply
28 : mpl::bool_<(result_of::size<Sequence>::value == 0)>
29 {};
30 };
31
32 template <>
33 struct empty_impl<sequence_facade_tag>
34 {
35 template <typename Sequence>
36 struct apply : Sequence::template empty<Sequence> {};
37 };
38
39 template <>
40 struct empty_impl<mpl_sequence_tag>;
41 }
42
43 namespace result_of
44 {
45 template <typename Sequence>
46 struct empty
47 : extension::empty_impl<typename detail::tag_of<Sequence>::type>::
48 template apply<Sequence>
49 {};
50 }
51
52 template <typename Sequence>
53 inline typename result_of::empty<Sequence>::type
54 empty(Sequence const&)
55 {
56 typedef typename result_of::empty<Sequence>::type result;
57 return result();
58 }
59 }}
60
61 #endif