Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56376 - in trunk/boost/fusion: include view view/nview view/nview/detail
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-24 20:20:05


Author: hkaiser
Date: 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
New Revision: 56376
URL: http://svn.boost.org/trac/boost/changeset/56376

Log:
Fusion: added nview and friends
Added:
   trunk/boost/fusion/include/nview.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/
   trunk/boost/fusion/view/nview.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/
   trunk/boost/fusion/view/nview/detail/advance_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/at_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/begin_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/deref_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/distance_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/end_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/equal_to_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/next_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/nview_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/prior_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/value_at_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/detail/value_of_impl.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/nview.hpp (contents, props changed)
   trunk/boost/fusion/view/nview/nview_iterator.hpp (contents, props changed)

Added: trunk/boost/fusion/include/nview.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/include/nview.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,12 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ 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_INCLUDE_NVIEW)
+#define FUSION_INCLUDE_NVIEW
+
+#include <boost/fusion/view/nview.hpp>
+
+#endif

Added: trunk/boost/fusion/view/nview.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,15 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_SEP_23_2009_1107PM)
+#define FUSION_NVIEW_SEP_23_2009_1107PM
+
+#include <boost/fusion/view/nview/nview.hpp>
+#include <boost/fusion/view/nview/nview_iterator.hpp>
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/advance_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/advance_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM)
+#define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM
+
+#include <boost/mpl/advance.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct advance_impl;
+
+ template<>
+ struct advance_impl<nview_iterator_tag>
+ {
+ template<typename Iterator, typename Dist>
+ struct apply
+ {
+ typedef typename Iterator::first_type::iterator_type iterator_type;
+ typedef typename Iterator::sequence_type sequence_type;
+
+ typedef nview_iterator<sequence_type,
+ typename mpl::advance<iterator_type, Dist>::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(i.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/at_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,45 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_AT_IMPL_SEP_24_2009_0225PM)
+#define BOOST_FUSION_NVIEW_AT_IMPL_SEP_24_2009_0225PM
+
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct at_impl;
+
+ template<>
+ struct at_impl<nview_tag>
+ {
+ template<typename Sequence, typename N>
+ struct apply
+ {
+ typedef typename Sequence::sequence_type sequence_type;
+ typedef typename Sequence::index_type index_type;
+
+ typedef typename result_of::at<index_type, N>::type index;
+ typedef typename result_of::at<sequence_type, index>::type type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return fusion::at<index>(seq.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/begin_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/begin_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM)
+#define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM
+
+#include <boost/mpl/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct begin_impl;
+
+ template<>
+ struct begin_impl<nview_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename Sequence::sequence_type sequence_type;
+ typedef typename Sequence::index_type index_type;
+
+ typedef nview_iterator<sequence_type,
+ typename mpl::begin<index_type>::type> type;
+
+ static type call(Sequence& v)
+ {
+ return type(v.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif
+

Added: trunk/boost/fusion/view/nview/detail/deref_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/deref_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,47 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM)
+#define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM
+
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct deref_impl;
+
+ template<>
+ struct deref_impl<nview_iterator_tag>
+ {
+ template<typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename Iterator::sequence_type sequence_type;
+
+ typedef typename result_of::deref<first_type>::type index;
+ typedef typename result_of::at<sequence_type, index>::type type;
+
+ static type call(Iterator const& i)
+ {
+ return at<index>(i.seq);
+ }
+ };
+ };
+
+ }
+
+}}
+
+#endif
+

Added: trunk/boost/fusion/view/nview/detail/distance_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/distance_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,44 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_DISTANCE_IMPL_SEP_23_2009_0328PM)
+#define BOOST_FUSION_NVIEW_DISTANCE_IMPL_SEP_23_2009_0328PM
+
+#include <boost/fusion/iterator/distance.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct distance_impl;
+
+ template<>
+ struct distance_impl<nview_iterator_tag>
+ {
+ template<typename First, typename Last>
+ struct apply
+ : result_of::distance<typename First::first_type, typename Last::first_type>
+ {
+ typedef typename result_of::distance<
+ typename First::first_type, typename Last::first_type
+ >::type type;
+
+ static type
+ call(First const& first, Last const& last)
+ {
+ return type();
+ }
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/end_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/end_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,51 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_END_IMPL_SEP_24_2009_0140PM)
+#define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM
+
+#include <boost/mpl/end.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct end_impl;
+
+ // Unary Version
+ template <>
+ struct end_impl<nview_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef typename Sequence::sequence_type sequence_type;
+ typedef typename Sequence::index_type index_type;
+
+ typedef nview_iterator<sequence_type,
+ typename mpl::end<index_type>::type> type;
+
+ static type call(Sequence& v)
+ {
+ return type(v.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif
+
+

Added: trunk/boost/fusion/view/nview/detail/equal_to_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/equal_to_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,33 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_ITERATOR_SEP_24_2009_0329PM)
+#define BOOST_FUSION_NVIEW_ITERATOR_SEP_24_2009_0329PM
+
+#include <boost/fusion/iterator/equal_to.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct equal_to_impl;
+
+ template<>
+ struct equal_to_impl<nview_iterator_tag>
+ {
+ template<typename It1, typename It2>
+ struct apply
+ : result_of::equal_to<typename It1::first_type, typename It2::first_type>
+ {};
+ };
+ }
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/next_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/next_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,48 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM)
+#define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM
+
+#include <boost/mpl/next.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct next_impl;
+
+ template <>
+ struct next_impl<nview_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type::iterator_type first_type;
+ typedef typename Iterator::sequence_type sequence_type;
+
+ typedef nview_iterator<sequence_type,
+ typename mpl::next<first_type>::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(i.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/nview_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/nview_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,66 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_PP_IS_ITERATING
+
+#if !defined(BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM)
+#define BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repeat.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+#define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (1, FUSION_MAX_VECTOR_SIZE, \
+ "boost/fusion/view/nview/detail/nview_impl.hpp")) \
+ /**/
+
+#include BOOST_PP_ITERATE()
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace fusion { namespace result_of
+{
+ template <typename Sequence
+ , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_VECTOR_SIZE, int I, -1)>
+ struct as_nview
+ {
+ typedef mpl::vector_c<
+ int, BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, I)
+ > index_type;
+
+ typedef nview<Sequence, index_type> type;
+ };
+
+}}}
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Preprocessor vertical repetition code
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+
+namespace boost { namespace fusion
+{
+ template<BOOST_PP_ENUM_PARAMS(N, int I), typename Sequence>
+ inline nview<Sequence, mpl::vector_c<int, BOOST_PP_ENUM_PARAMS(N, I)> >
+ as_nview(Sequence& s)
+ {
+ typedef mpl::vector_c<int, BOOST_PP_ENUM_PARAMS(N, I)> index_type;
+ return nview<Sequence, index_type>(s);
+ }
+
+}}
+
+#undef N
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/prior_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/prior_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,48 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM)
+#define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM
+
+#include <boost/mpl/prior.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct prior_impl;
+
+ template <>
+ struct prior_impl<nview_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type::iterator_type first_type;
+ typedef typename Iterator::sequence_type sequence_type;
+
+ typedef nview_iterator<sequence_type,
+ typename mpl::prior<first_type>::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(i.seq);
+ }
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/value_at_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,39 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_VALUE_AT_IMPL_SEP_24_2009_0234PM)
+#define BOOST_FUSION_NVIEW_VALUE_AT_IMPL_SEP_24_2009_0234PM
+
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_tag;
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct value_at_impl;
+
+ template<>
+ struct value_at_impl<nview_tag>
+ {
+ template<typename Sequence, typename N>
+ struct apply
+ {
+ typedef typename Sequence::sequence_type sequence_type;
+ typedef typename Sequence::index_type index_type;
+
+ typedef typename result_of::at<index_type, N>::type index;
+ typedef typename result_of::at<sequence_type, index>::type type;
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/detail/value_of_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/detail/value_of_impl.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_OF_PRIOR_IMPL_SEP_24_2009_0158PM)
+#define BOOST_FUSION_VALUE_OF_PRIOR_IMPL_SEP_24_2009_0158PM
+
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+
+ template <typename Sequence, typename Pos>
+ struct nview_iterator;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct value_of_impl;
+
+ template <>
+ struct value_of_impl<nview_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename Iterator::sequence_type sequence_type;
+
+ typedef typename result_of::deref<first_type>::type index;
+ typedef typename result_of::at<sequence_type, index>::type type;
+ };
+ };
+ }
+
+}}
+
+#endif

Added: trunk/boost/fusion/view/nview/nview.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/nview.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,79 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_SEP_23_2009_0948PM)
+#define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM
+
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/utility/result_of.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/support/sequence_base.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/view/transform_view.hpp>
+
+namespace boost { namespace fusion
+{
+ namespace detail
+ {
+ struct addref
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename U>
+ struct result<addref(U)> : boost::add_reference<U> {};
+
+ template <typename T>
+ typename boost::result_of<addref(T)>::type
+ operator()(T& x) const
+ {
+ return x;
+ }
+ };
+ }
+
+ struct nview_tag;
+ struct random_access_traversal_tag;
+ struct fusion_sequence_tag;
+
+ template<typename Sequence, typename Indicies>
+ struct nview
+ : sequence_base<nview<Sequence, Indicies> >
+ {
+ typedef nview_tag fusion_tag;
+ typedef fusion_sequence_tag tag; // this gets picked up by MPL
+ typedef random_access_traversal_tag category;
+
+ typedef mpl::true_ is_view;
+ typedef Indicies index_type;
+ typedef typename mpl::size<Indicies>::type size;
+
+ typedef transform_view<Sequence, detail::addref> transform_view_type;
+ typedef typename result_of::as_vector<transform_view_type>::type
+ sequence_type;
+
+ explicit nview(Sequence& val)
+ : seq(as_vector(transform_view_type(val, detail::addref())))
+ {}
+
+ sequence_type seq;
+ };
+
+}}
+
+// define the nview() generator functions
+#include <boost/fusion/view/nview/detail/nview_impl.hpp>
+
+#endif
+
+

Added: trunk/boost/fusion/view/nview/nview_iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/view/nview/nview_iterator.hpp 2009-09-24 20:20:03 EDT (Thu, 24 Sep 2009)
@@ -0,0 +1,53 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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_NVIEW_ITERATOR_SEP_23_2009_0948PM)
+#define BOOST_FUSION_NVIEW_ITERATOR_SEP_23_2009_0948PM
+
+#include <boost/fusion/support/iterator_base.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
+
+#include <boost/fusion/view/nview/detail/begin_impl.hpp>
+#include <boost/fusion/view/nview/detail/end_impl.hpp>
+#include <boost/fusion/view/nview/detail/deref_impl.hpp>
+#include <boost/fusion/view/nview/detail/value_of_impl.hpp>
+#include <boost/fusion/view/nview/detail/next_impl.hpp>
+#include <boost/fusion/view/nview/detail/prior_impl.hpp>
+#include <boost/fusion/view/nview/detail/at_impl.hpp>
+#include <boost/fusion/view/nview/detail/value_at_impl.hpp>
+#include <boost/fusion/view/nview/detail/advance_impl.hpp>
+#include <boost/fusion/view/nview/detail/distance_impl.hpp>
+#include <boost/fusion/view/nview/detail/equal_to_impl.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nview_iterator_tag;
+ struct random_access_traversal_tag;
+
+ template<typename Sequence, typename Pos>
+ struct nview_iterator
+ : iterator_base<nview_iterator<Sequence, Pos> >
+ {
+ typedef nview_iterator_tag fusion_tag;
+ typedef random_access_traversal_tag category;
+
+ typedef Sequence sequence_type;
+ typedef mpl_iterator<Pos> first_type;
+
+ explicit nview_iterator(Sequence& seq)
+ : seq(seq) {}
+
+ Sequence& seq;
+ };
+
+}}
+
+#endif
+
+


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