[SVN r37329]
This commit is contained in:
Joel de Guzman
2007-04-02 03:52:41 +00:00
parent 6002bc9bb4
commit 5423cde1f1
2 changed files with 45 additions and 30 deletions

View File

@ -0,0 +1,44 @@
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM)
#define FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM
#include <boost/type_traits/add_const.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename Struct, int N>
struct struct_member;
template <typename Struct>
struct struct_size;
template <typename Struct, int N>
struct struct_member<Struct const, N>
{
typedef typename
add_const<typename struct_member<Struct, N>::type>::type
type;
static type&
call(Struct const& struct_)
{
return struct_member<Struct, N>::call(
const_cast<Struct&>(struct_));
}
};
template <typename Struct>
struct struct_size<Struct const>
: struct_size<Struct>
{};
}}}
#endif

View File

@ -9,9 +9,9 @@
#define FUSION_STRUCT_ITERATOR_APRIL_2_2007_1008AM
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/sequence/adapted/struct/extension.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
@ -21,35 +21,6 @@
namespace boost { namespace fusion
{
namespace extension
{
template <typename Struct, int N>
struct struct_member;
template <typename Struct>
struct struct_size;
template <typename Struct, int N>
struct struct_member<Struct const, N>
{
typedef typename
add_const<typename struct_member<Struct, N>::type>::type
type;
static type&
call(Struct const& struct_)
{
return struct_member<Struct, N>::call(
const_cast<Struct&>(struct_));
}
};
template <typename Struct>
struct struct_size<Struct const>
: struct_size<Struct>
{};
}
struct random_access_traversal_tag;
template <typename Struct, int N_>