Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59577 - in trunk: boost/fusion/adapted/array boost/fusion/adapted/array/detail boost/fusion/adapted/boost_array boost/fusion/adapted/boost_array/detail libs/fusion/test/sequence
From: mr.chr.schmidt_at_[hidden]
Date: 2010-02-07 13:48:11


Author: cschmidt
Date: 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
New Revision: 59577
URL: http://svn.boost.org/trac/boost/changeset/59577

Log:
adapt plain old array types (2)
Added:
   trunk/boost/fusion/adapted/array/at_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/begin_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/category_of_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/deref_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/end_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/is_sequence_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/is_view_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/size_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/value_at_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/array/value_of_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/
   trunk/boost/fusion/adapted/boost_array/array_iterator.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/
   trunk/boost/fusion/adapted/boost_array/detail/at_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/begin_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/category_of_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/end_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/is_sequence_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/is_view_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/size_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/detail/value_at_impl.hpp (contents, props changed)
   trunk/boost/fusion/adapted/boost_array/tag_of.hpp (contents, props changed)
   trunk/libs/fusion/test/sequence/array.cpp (contents, props changed)
Removed:
   trunk/boost/fusion/adapted/array/array_iterator.hpp
   trunk/boost/fusion/adapted/array/detail/
Text files modified:
   trunk/boost/fusion/adapted/array/tag_of.hpp | 92 +++++++++++++++++++++++----------------
   1 files changed, 53 insertions(+), 39 deletions(-)

Deleted: trunk/boost/fusion/adapted/array/array_iterator.hpp
==============================================================================
--- trunk/boost/fusion/adapted/array/array_iterator.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
+++ (empty file)
@@ -1,107 +0,0 @@
-/*=============================================================================
- 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

Added: trunk/boost/fusion/adapted/array/at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/at_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,38 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_AT_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_AT_IMPL_HPP
+
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/remove_extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct at_impl;
+
+ template<>
+ struct at_impl<po_array_tag>
+ {
+ template<typename Seq, typename N>
+ struct apply
+ {
+ typedef typename
+ add_reference<typename remove_extent<Seq>::type>::type
+ type;
+
+ static type
+ call(Seq& seq)
+ {
+ return seq[N::value];
+ }
+ };
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/begin_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/begin_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,42 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_BEGIN_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_BEGIN_IMPL_HPP
+
+#include <boost/fusion/iterator/basic_iterator.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct begin_impl;
+
+ template <>
+ struct begin_impl<po_array_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ po_array_iterator_tag
+ , random_access_traversal_tag
+ , Seq
+ , 0
+ >
+ type;
+
+ static type
+ call(Seq& seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/category_of_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/category_of_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,32 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_CATEGORY_OF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_CATEGORY_OF_IMPL_HPP
+
+namespace boost { namespace fusion
+{
+ struct random_access_traversal_tag;
+
+ namespace extension
+ {
+ template<typename>
+ struct category_of_impl;
+
+ template<>
+ struct category_of_impl<po_array_tag>
+ {
+ template<typename Seq>
+ struct apply
+ {
+ typedef random_access_traversal_tag type;
+ };
+ };
+ }
+}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/deref_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/deref_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,40 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
+
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/remove_extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct deref_impl;
+
+ template <>
+ struct deref_impl<po_array_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename
+ add_reference<
+ typename remove_extent<typename It::seq_type>::type
+ >::type
+ type;
+
+ static type
+ call(It const& it)
+ {
+ return (*it.seq)[It::index::value];
+ }
+ };
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/end_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/end_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,44 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_END_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_END_IMPL_HPP
+
+#include <boost/fusion/iterator/basic_iterator.hpp>
+#include <boost/type_traits/rank.hpp>
+#include <boost/type_traits/extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct end_impl;
+
+ template <>
+ struct end_impl<po_array_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ po_array_iterator_tag
+ , random_access_traversal_tag
+ , Seq
+ , extent<Seq,rank<Seq>::value-1>::value
+ >
+ type;
+
+ static type
+ call(Seq& seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/is_sequence_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/is_sequence_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_IS_SEQUENCE_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_IS_SEQUENCE_IMPL_HPP
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct is_sequence_impl;
+
+ template<>
+ struct is_sequence_impl<po_array_tag>
+ {
+ template<typename Seq>
+ struct apply
+ : mpl::true_
+ {};
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/is_view_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/is_view_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_IS_VIEW_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_IS_VIEW_IMPL_HPP
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct is_view_impl;
+
+ template<>
+ struct is_view_impl<po_array_tag>
+ {
+ template<typename Seq>
+ struct apply
+ : mpl::false_
+ {};
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/size_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/size_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,29 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_SIZE_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_SIZE_IMPL_HPP
+
+#include <boost/type_traits/rank.hpp>
+#include <boost/type_traits/extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct size_impl;
+
+ template<>
+ struct size_impl<po_array_tag>
+ {
+ template<typename Seq>
+ struct apply
+ : extent<Seq,rank<Seq>::value-1>
+ {};
+ };
+}}}
+
+#endif

Modified: trunk/boost/fusion/adapted/array/tag_of.hpp
==============================================================================
--- trunk/boost/fusion/adapted/array/tag_of.hpp (original)
+++ trunk/boost/fusion/adapted/array/tag_of.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -1,58 +1,72 @@
 /*=============================================================================
- Copyright (c) 2001-2006 Joel de Guzman
- Copyright (c) 2005-2006 Dan Marsden
+ Copyright (c) 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(FUSION_SEQUENCE_TAG_OF_27122005_1030)
-#define FUSION_SEQUENCE_TAG_OF_27122005_1030
 
-#include <boost/fusion/support/tag_of_fwd.hpp>
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_TAG_OF_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_TAG_OF_HPP
 
+#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
+namespace boost
 {
- struct array_tag;
- struct fusion_sequence_tag;
-
- namespace traits
+ namespace fusion
     {
- template<typename T, std::size_t N>
-#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
- struct tag_of<boost::array<T,N>, void >
+ struct po_array_tag;
+ struct po_array_iterator_tag;
+ struct random_access_traversal_tag;
+ struct fusion_sequence_tag;
+
+ namespace traits
+ {
+#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
+ template<typename T, std::size_t N>
+ struct tag_of<T[N], void>
+ {
+ typedef po_array_tag type;
+ };
+
+ template<typename T, std::size_t N>
+ struct tag_of<T const[N], void>
+ {
+ typedef po_array_tag type;
+ };
 #else
- struct tag_of<boost::array<T,N> >
+ template<typename T, std::size_t N>
+ struct tag_of<T[N], void>
+ {
+ typedef po_array_tag type;
+ };
+
+ template<typename T, std::size_t N>
+ struct tag_of<T const[N], void>
+ {
+ typedef po_array_tag type;
+ };
 #endif
- {
- typedef array_tag type;
- };
+ }
     }
-}}
-
-namespace boost { namespace mpl
-{
- template<typename>
- struct sequence_tag;
 
- template<typename T, std::size_t N>
- struct sequence_tag<array<T,N> >
+ namespace mpl
     {
- typedef fusion::fusion_sequence_tag type;
- };
+ template<typename>
+ struct sequence_tag;
 
- template<typename T, std::size_t N>
- struct sequence_tag<array<T,N> const>
- {
- typedef fusion::fusion_sequence_tag type;
- };
-}}
+ template<typename T, std::size_t N>
+ struct sequence_tag<T[N]>
+ {
+ typedef fusion::po_array_tag type;
+ };
+
+ template<typename T, std::size_t N>
+ struct sequence_tag<T const[N] >
+ {
+ typedef fusion::po_array_tag type;
+ };
+ }
+}
 
 #endif

Added: trunk/boost/fusion/adapted/array/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/value_at_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_VALUE_AT_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_VALUE_AT_IMPL_HPP
+
+#include <boost/type_traits/remove_extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct value_at_impl;
+
+ template <>
+ struct value_at_impl<po_array_tag>
+ {
+ template <typename Seq, typename N>
+ struct apply
+ : remove_extent<Seq>
+ {};
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/array/value_of_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/array/value_of_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_ADAPTED_ARRAY_VALUE_OF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_ARRAY_VALUE_OF_IMPL_HPP
+
+#include <boost/type_traits/remove_extent.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct value_of_impl;
+
+ template <>
+ struct value_of_impl<po_array_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ : remove_extent<typename It::seq_type>
+ {};
+ };
+}}}
+
+#endif

Added: trunk/boost/fusion/adapted/boost_array/array_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/array_iterator.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/at_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/begin_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/begin_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/category_of_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/category_of_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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 <boost/config/no_tr1/utility.hpp>
+
+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

Added: trunk/boost/fusion/adapted/boost_array/detail/end_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/end_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/is_sequence_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/is_sequence_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/is_view_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/is_view_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/size_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/size_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/detail/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/detail/value_at_impl.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -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

Added: trunk/boost/fusion/adapted/boost_array/tag_of.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/adapted/boost_array/tag_of.hpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,58 @@
+/*=============================================================================
+ 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;
+ struct fusion_sequence_tag;
+
+ namespace traits
+ {
+ template<typename T, std::size_t N>
+#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
+ struct tag_of<boost::array<T,N>, void >
+#else
+ struct tag_of<boost::array<T,N> >
+#endif
+ {
+ typedef array_tag type;
+ };
+ }
+}}
+
+namespace boost { namespace mpl
+{
+ template<typename>
+ struct sequence_tag;
+
+ template<typename T, std::size_t N>
+ struct sequence_tag<array<T,N> >
+ {
+ typedef fusion::fusion_sequence_tag type;
+ };
+
+ template<typename T, std::size_t N>
+ struct sequence_tag<array<T,N> const>
+ {
+ typedef fusion::fusion_sequence_tag type;
+ };
+}}
+
+#endif

Added: trunk/libs/fusion/test/sequence/array.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/sequence/array.cpp 2010-02-07 13:48:09 EST (Sun, 07 Feb 2010)
@@ -0,0 +1,39 @@
+/*=============================================================================
+ Copyright (c) 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)
+==============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/fusion/adapted/array.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/is_view.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ typedef int array_type[3];
+
+ BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
+ BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
+
+ array_type arr = {1,2,3};
+
+ BOOST_TEST(*begin(arr) == 1);
+ BOOST_TEST(*next(begin(arr)) == 2);
+ BOOST_TEST(*advance_c<2>(begin(arr)) == 3);
+ BOOST_TEST(prior(next(begin(arr))) == begin(arr));
+ BOOST_TEST(*prior(end(arr)) == 3);
+ BOOST_TEST(at_c<2>(arr) == 3);
+ BOOST_TEST(size(arr) == 3);
+ BOOST_TEST(distance(begin(arr), end(arr)) == 3);
+
+ return boost::report_errors();
+}
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk