forked from boostorg/fusion
adapt template classes/structs
[SVN r59846]
This commit is contained in:
@ -1,63 +1,58 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2009-2010 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_AT_IMPL_24122005_1807)
|
||||
#define BOOST_FUSION_AT_IMPL_24122005_1807
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
struct struct_tag;
|
||||
template<typename>
|
||||
struct at_impl;
|
||||
|
||||
namespace extension
|
||||
template <>
|
||||
struct at_impl<struct_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template <typename Struct, int N>
|
||||
struct struct_member;
|
||||
|
||||
template <typename Struct>
|
||||
struct struct_size;
|
||||
|
||||
template <>
|
||||
struct at_impl<struct_tag>
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
typedef
|
||||
extension::struct_member<
|
||||
typename remove_const<Seq>::type
|
||||
, N::value
|
||||
>
|
||||
member;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<Seq>
|
||||
, detail::cref_result<member>
|
||||
, detail::ref_result<member>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
static int const n_value = N::value;
|
||||
BOOST_MPL_ASSERT_RELATION(
|
||||
n_value, <=, extension::struct_size<Sequence>::value);
|
||||
|
||||
typedef typename
|
||||
extension::struct_member<Sequence, N::value>
|
||||
element;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<Sequence>
|
||||
, detail::cref_result<element>
|
||||
, detail::ref_result<element>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return extension::
|
||||
struct_member<Sequence, N::value>::call(seq);
|
||||
}
|
||||
};
|
||||
return member::call(seq);
|
||||
}
|
||||
};
|
||||
}
|
||||
}}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct at_impl<assoc_struct_tag>
|
||||
: at_impl<struct_tag>
|
||||
{};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user