phase3: refactoring for v2.1

[SVN r40211]
This commit is contained in:
Joel de Guzman
2007-10-20 11:50:27 +00:00
parent d0d540064d
commit 16bcb17c06
118 changed files with 199 additions and 211 deletions

View File

@ -0,0 +1,107 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_ARRAY_ITERATOR_26122005_2250)
#define BOOST_FUSION_ARRAY_ITERATOR_26122005_2250
#include <cstddef>
#include <boost/config.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
namespace boost { namespace fusion
{
struct random_access_traversal_tag;
template <typename Array, int Pos>
struct array_iterator
: iterator_facade<array_iterator<Array, Pos>, random_access_traversal_tag>
{
BOOST_MPL_ASSERT_RELATION(Pos, >=, 0);
BOOST_MPL_ASSERT_RELATION(Pos, <=, Array::static_size);
typedef mpl::int_<Pos> index;
typedef Array array_type;
array_iterator(Array& a)
: array(a) {}
Array& array;
template <typename Iterator>
struct value_of
{
typedef typename Iterator::array_type array_type;
typedef typename array_type::value_type type;
};
template <typename Iterator>
struct deref
{
typedef typename Iterator::array_type array_type;
typedef typename
mpl::if_<
is_const<array_type>
, typename array_type::const_reference
, typename array_type::reference
>::type
type;
static type
call(Iterator const & it)
{
return it.array[Iterator::index::value];
}
};
template <typename Iterator, typename N>
struct advance
{
typedef typename Iterator::index index;
typedef typename Iterator::array_type array_type;
typedef array_iterator<array_type, index::value + N::value> type;
static type
call(Iterator const& i)
{
return type(i.array);
}
};
template <typename Iterator>
struct next : advance<Iterator, mpl::int_<1> > {};
template <typename Iterator>
struct prior : advance<Iterator, mpl::int_<-1> > {};
template <typename I1, typename I2>
struct distance : mpl::minus<typename I2::index, typename I1::index>
{
typedef typename
mpl::minus<
typename I2::index, typename I1::index
>::type
type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
private:
array_iterator<Array, Pos>& operator=(array_iterator<Array, Pos> const&);
};
}}
#endif

View File

@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_AT_IMPL_27122005_1241)
#define BOOST_FUSION_AT_IMPL_27122005_1241
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template<typename T>
struct at_impl;
template<>
struct at_impl<array_tag>
{
template<typename Sequence, typename N>
struct apply
{
typedef typename mpl::if_<
is_const<Sequence>,
typename Sequence::const_reference,
typename Sequence::reference>::type type;
static type
call(Sequence& seq)
{
return seq[N::value];
}
};
};
}
}}
#endif

View File

@ -0,0 +1,40 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_BEGIN_IMPL_27122005_1117)
#define BOOST_FUSION_BEGIN_IMPL_27122005_1117
#include <boost/fusion/adapted/array/array_iterator.hpp>
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template<typename T>
struct begin_impl;
template <>
struct begin_impl<array_tag>
{
template <typename Sequence>
struct apply
{
typedef array_iterator<Sequence, 0> type;
static type
call(Sequence& v)
{
return type(v);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_CATEGORY_OF_IMPL_27122005_1044)
#define BOOST_FUSION_CATEGORY_OF_IMPL_27122005_1044
#include <utility>
namespace boost { namespace fusion {
struct array_tag;
struct random_access_traversal_tag;
namespace extension
{
template<typename T>
struct category_of_impl;
template<>
struct category_of_impl<array_tag>
{
template<typename T>
struct apply
{
typedef random_access_traversal_tag type;
};
};
}
}}
#endif

View File

@ -0,0 +1,40 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_END_IMPL_27122005_1120)
#define BOOST_FUSION_END_IMPL_27122005_1120
#include <boost/fusion/adapted/array/array_iterator.hpp>
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<array_tag>
{
template <typename Sequence>
struct apply
{
typedef array_iterator<Sequence, Sequence::static_size> type;
static type
call(Sequence& v)
{
return type(v);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,31 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1648)
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1648
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template<typename Tag>
struct is_sequence_impl;
template<>
struct is_sequence_impl<array_tag>
{
template<typename Sequence>
struct apply : mpl::true_ {};
};
}
}}
#endif

View File

@ -0,0 +1,32 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_IS_VIEW_IMPL_27042006_2221)
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2221
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct array_tag;
namespace extension
{
template<typename Tag>
struct is_view_impl;
template<>
struct is_view_impl<array_tag>
{
template<typename T>
struct apply : mpl::false_
{};
};
}
}}
#endif

View File

@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_SIZE_IMPL_27122005_1251)
#define BOOST_FUSION_SIZE_IMPL_27122005_1251
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template<typename T>
struct size_impl;
template<>
struct size_impl<array_tag>
{
template<typename Sequence>
struct apply : mpl::int_<Sequence::static_size> {};
};
}
}}
#endif

View File

@ -0,0 +1,32 @@
/*=============================================================================
Copyright (c) 2001-2006 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(BOOST_FUSION_VALUE_AT_IMPL_27122005_1256)
#define BOOST_FUSION_VALUE_AT_IMPL_27122005_1256
namespace boost { namespace fusion {
struct array_tag;
namespace extension
{
template<typename T>
struct value_at_impl;
template <>
struct value_at_impl<array_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename Sequence::value_type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2006 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_SEQUENCE_TAG_OF_27122005_1030)
#define FUSION_SEQUENCE_TAG_OF_27122005_1030
#include <boost/fusion/support/tag_of_fwd.hpp>
#include <cstddef>
namespace boost
{
template<typename T, std::size_t N>
class array;
}
namespace boost { namespace fusion
{
struct array_tag;
namespace traits
{
template<typename T, std::size_t N>
struct tag_of<boost::array<T,N> >
{
typedef array_tag type;
};
}
}}
#endif