OLD | NEW |
(Empty) | |
| 1 /*============================================================================= |
| 2 Copyright (c) 2001-2006 Joel de Guzman |
| 3 Copyright (c) 2005-2006 Dan Marsden |
| 4 |
| 5 Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 ==============================================================================*/ |
| 8 #if !defined(BOOST_FUSION_AT_IMPL_24122005_1807) |
| 9 #define BOOST_FUSION_AT_IMPL_24122005_1807 |
| 10 |
| 11 #include <boost/fusion/support/detail/access.hpp> |
| 12 #include <boost/mpl/assert.hpp> |
| 13 #include <boost/mpl/int.hpp> |
| 14 |
| 15 namespace boost { namespace fusion |
| 16 { |
| 17 struct struct_tag; |
| 18 |
| 19 namespace extension |
| 20 { |
| 21 template<typename T> |
| 22 struct at_impl; |
| 23 |
| 24 template <typename Struct, int N> |
| 25 struct struct_member; |
| 26 |
| 27 template <typename Struct> |
| 28 struct struct_size; |
| 29 |
| 30 template <> |
| 31 struct at_impl<struct_tag> |
| 32 { |
| 33 template <typename Sequence, typename N> |
| 34 struct apply |
| 35 { |
| 36 static int const n_value = N::value; |
| 37 BOOST_MPL_ASSERT_RELATION( |
| 38 n_value, <=, extension::struct_size<Sequence>::value); |
| 39 |
| 40 typedef typename |
| 41 extension::struct_member<Sequence, N::value> |
| 42 element; |
| 43 |
| 44 typedef typename |
| 45 mpl::eval_if< |
| 46 is_const<Sequence> |
| 47 , detail::cref_result<element> |
| 48 , detail::ref_result<element> |
| 49 >::type |
| 50 type; |
| 51 |
| 52 static type |
| 53 call(Sequence& seq) |
| 54 { |
| 55 return extension:: |
| 56 struct_member<Sequence, N::value>::call(seq); |
| 57 } |
| 58 }; |
| 59 }; |
| 60 } |
| 61 }} |
| 62 |
| 63 #endif |
OLD | NEW |