Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/segments.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 Eric Niebler | |
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(BOOST_FUSION_SEGMENTS_04052005_1141) | |
8 #define BOOST_FUSION_SEGMENTS_04052005_1141 | |
9 | |
10 #include <boost/type_traits/is_const.hpp> | |
11 #include <boost/utility/enable_if.hpp> | |
12 #include <boost/fusion/sequence/intrinsic_fwd.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 iterator_range_tag; | |
20 | |
21 // segments: returns a sequence of sequences | |
22 namespace extension | |
23 { | |
24 template <typename Tag> | |
25 struct segments_impl | |
26 { | |
27 template <typename Sequence> | |
28 struct apply {}; | |
29 }; | |
30 | |
31 template <> | |
32 struct segments_impl<sequence_facade_tag> | |
33 { | |
34 template <typename Sequence> | |
35 struct apply : Sequence::template segments<Sequence> {}; | |
36 }; | |
37 | |
38 template <> | |
39 struct segments_impl<iterator_range_tag>; | |
40 } | |
41 | |
42 namespace result_of | |
43 { | |
44 template <typename Sequence> | |
45 struct segments | |
46 { | |
47 typedef typename traits::tag_of<Sequence>::type tag_type; | |
48 | |
49 typedef typename | |
50 extension::segments_impl<tag_type>::template apply<Sequence>::type | |
51 type; | |
52 }; | |
53 } | |
54 | |
55 template <typename Sequence> | |
56 inline typename | |
57 lazy_disable_if< | |
58 is_const<Sequence> | |
59 , result_of::segments<Sequence> | |
60 >::type | |
61 segments(Sequence& seq) | |
62 { | |
63 typedef typename traits::tag_of<Sequence>::type tag_type; | |
64 return extension::segments_impl<tag_type>::template apply<Sequence>::call(seq); | |
65 } | |
66 | |
67 template <typename Sequence> | |
68 inline typename result_of::segments<Sequence const>::type | |
69 segments(Sequence const& seq) | |
70 { | |
71 typedef typename traits::tag_of<Sequence const>::type tag_type; | |
72 return extension::segments_impl<tag_type>::template apply<Sequence const>::call(seq); | |
73 } | |
74 }} | |
75 | |
76 #endif |