annotate DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/at.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3
Chris@16 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 ==============================================================================*/
Chris@16 7 #if !defined(FUSION_AT_05042005_0722)
Chris@16 8 #define FUSION_AT_05042005_0722
Chris@16 9
Chris@16 10 #include <boost/mpl/int.hpp>
Chris@16 11 #include <boost/type_traits/is_const.hpp>
Chris@16 12 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
Chris@16 13 #include <boost/fusion/support/tag_of.hpp>
Chris@16 14 #include <boost/fusion/support/detail/access.hpp>
Chris@16 15
Chris@16 16 namespace boost { namespace fusion
Chris@16 17 {
Chris@16 18 // Special tags:
Chris@16 19 struct sequence_facade_tag;
Chris@16 20 struct boost_tuple_tag; // boost::tuples::tuple tag
Chris@16 21 struct boost_array_tag; // boost::array tag
Chris@16 22 struct mpl_sequence_tag; // mpl sequence tag
Chris@16 23 struct std_pair_tag; // std::pair tag
Chris@16 24 struct std_tuple_tag; // std::tuple tag
Chris@16 25
Chris@16 26 namespace extension
Chris@16 27 {
Chris@16 28 template <typename Tag>
Chris@16 29 struct at_impl
Chris@16 30 {
Chris@16 31 template <typename Sequence, typename N>
Chris@16 32 struct apply;
Chris@16 33 };
Chris@16 34
Chris@16 35 template <>
Chris@16 36 struct at_impl<sequence_facade_tag>
Chris@16 37 {
Chris@16 38 template <typename Sequence, typename N>
Chris@16 39 struct apply : Sequence::template at<Sequence, N> {};
Chris@16 40 };
Chris@16 41
Chris@16 42 template <>
Chris@16 43 struct at_impl<boost_tuple_tag>;
Chris@16 44
Chris@16 45 template <>
Chris@16 46 struct at_impl<boost_array_tag>;
Chris@16 47
Chris@16 48 template <>
Chris@16 49 struct at_impl<mpl_sequence_tag>;
Chris@16 50
Chris@16 51 template <>
Chris@16 52 struct at_impl<std_pair_tag>;
Chris@16 53
Chris@16 54 template <>
Chris@16 55 struct at_impl<std_tuple_tag>;
Chris@16 56 }
Chris@16 57
Chris@16 58 namespace result_of
Chris@16 59 {
Chris@16 60 template <typename Sequence, typename N>
Chris@16 61 struct at
Chris@16 62 : extension::at_impl<typename detail::tag_of<Sequence>::type>::
Chris@16 63 template apply<Sequence, N>
Chris@16 64 {};
Chris@16 65
Chris@16 66 template <typename Sequence, int N>
Chris@16 67 struct at_c
Chris@16 68 : at<Sequence, mpl::int_<N> >
Chris@16 69 {};
Chris@16 70 }
Chris@16 71
Chris@16 72
Chris@16 73 template <typename N, typename Sequence>
Chris@16 74 inline typename
Chris@16 75 lazy_disable_if<
Chris@16 76 is_const<Sequence>
Chris@16 77 , result_of::at<Sequence, N>
Chris@16 78 >::type
Chris@16 79 at(Sequence& seq)
Chris@16 80 {
Chris@16 81 return result_of::at<Sequence, N>::call(seq);
Chris@16 82 }
Chris@16 83
Chris@16 84 template <typename N, typename Sequence>
Chris@16 85 inline typename result_of::at<Sequence const, N>::type
Chris@16 86 at(Sequence const& seq)
Chris@16 87 {
Chris@16 88 return result_of::at<Sequence const, N>::call(seq);
Chris@16 89 }
Chris@16 90
Chris@16 91 template <int N, typename Sequence>
Chris@16 92 inline typename
Chris@16 93 lazy_disable_if<
Chris@16 94 is_const<Sequence>
Chris@16 95 , result_of::at_c<Sequence, N>
Chris@16 96 >::type
Chris@16 97 at_c(Sequence& seq)
Chris@16 98 {
Chris@16 99 return fusion::at<mpl::int_<N> >(seq);
Chris@16 100 }
Chris@16 101
Chris@16 102 template <int N, typename Sequence>
Chris@16 103 inline typename result_of::at_c<Sequence const, N>::type
Chris@16 104 at_c(Sequence const& seq)
Chris@16 105 {
Chris@16 106 return fusion::at<mpl::int_<N> >(seq);
Chris@16 107 }
Chris@16 108 }}
Chris@16 109
Chris@16 110 #endif
Chris@16 111