Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:42

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_VALUE_AT_05052005_0229)
0008 #define FUSION_VALUE_AT_05052005_0229
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/mpl/int.hpp>
0012 #include <boost/mpl/if.hpp>
0013 #include <boost/mpl/or.hpp>
0014 #include <boost/mpl/less.hpp>
0015 #include <boost/mpl/empty_base.hpp>
0016 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0017 #include <boost/fusion/support/tag_of.hpp>
0018 #include <boost/fusion/support/category_of.hpp>
0019 
0020 namespace boost { namespace fusion
0021 {
0022     // Special tags:
0023     struct sequence_facade_tag;
0024     struct boost_tuple_tag; // boost::tuples::tuple tag
0025     struct boost_array_tag; // boost::array tag
0026     struct mpl_sequence_tag; // mpl sequence tag
0027     struct std_pair_tag; // std::pair tag
0028 
0029     namespace extension
0030     {
0031         template <typename Tag>
0032         struct value_at_impl
0033         {
0034             template <typename Sequence, typename N>
0035             struct apply;
0036         };
0037 
0038         template <>
0039         struct value_at_impl<sequence_facade_tag>
0040         {
0041             template <typename Sequence, typename N>
0042             struct apply : Sequence::template value_at<Sequence, N> {};
0043         };
0044 
0045         template <>
0046         struct value_at_impl<boost_tuple_tag>;
0047 
0048         template <>
0049         struct value_at_impl<boost_array_tag>;
0050 
0051         template <>
0052         struct value_at_impl<mpl_sequence_tag>;
0053 
0054         template <>
0055         struct value_at_impl<std_pair_tag>;
0056     }
0057 
0058     namespace detail
0059     {
0060         template <typename Sequence, typename N, typename Tag>
0061         struct value_at_impl
0062             : mpl::if_<
0063                   mpl::or_<
0064                       mpl::less<N, typename extension::size_impl<Tag>::template apply<Sequence>::type>
0065                     , traits::is_unbounded<Sequence>
0066                   >
0067                 , typename extension::value_at_impl<Tag>::template apply<Sequence, N>
0068                 , mpl::empty_base
0069               >::type
0070         {};
0071     }
0072 
0073     namespace result_of
0074     {
0075         template <typename Sequence, typename N>
0076         struct value_at
0077             : detail::value_at_impl<Sequence, N, typename detail::tag_of<Sequence>::type>
0078         {};
0079 
0080         template <typename Sequence, int N>
0081         struct value_at_c
0082             : fusion::result_of::value_at<Sequence, mpl::int_<N> >
0083         {};
0084     }
0085 }}
0086 
0087 #endif
0088