Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56193 - in sandbox/SOC/2009/fusion: boost/fusion/algorithm/transformation boost/fusion/view/transform_view boost/fusion/view/transform_view/detail libs/fusion/example/test
From: mr.chr.schmidt_at_[hidden]
Date: 2009-09-14 15:58:22


Author: cschmidt
Date: 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
New Revision: 56193
URL: http://svn.boost.org/trac/boost/changeset/56193

Log:
associative transform_view
Added:
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_data_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/key_of_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp | 101 ++++++++++++++++++++++++++++++++--
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/advance_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/begin_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_impl.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/end_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/next_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/prior_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/transform_view_iterator.hpp | 46 ++++++++++++++--
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp | 24 +++++++-
   sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view_fwd.hpp | 8 +-
   sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp | 114 +++++++++++----------------------------
   11 files changed, 200 insertions(+), 104 deletions(-)

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -22,7 +22,12 @@
 
     namespace result_of
     {
- template <typename Seq1, typename Seq2, typename F = void_>
+ template<
+ typename Seq1
+ , typename Seq2
+ , typename F=mpl::false_
+ , typename IsAssociative=mpl::false_
+ >
         struct transform
         {
             BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq1>));
@@ -31,22 +36,64 @@
             BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq2>));
 
             typedef
- transform_view<Seq1, Seq2, typename traits::deduce<F>::type>
+ transform_view<
+ Seq1
+ , Seq2
+ , typename traits::deduce<F>::type
+ , IsAssociative
+ >
             type;
         };
 
         template <typename Seq, typename F>
-#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
- struct transform<Seq, F, void_>
-#else
- struct transform<Seq, F>
-#endif
+ struct transform<Seq, F, mpl::false_, mpl::false_>
         {
             BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
             BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
 
- typedef transform_view<Seq, typename traits::deduce<F>::type> type;
+ typedef
+ transform_view<
+ Seq
+ , typename traits::deduce<F>::type
+ , mpl::false_
+ >
+ type;
         };
+
+ template <typename Seq, typename F>
+ struct transform<Seq, F, mpl::true_, mpl::false_>
+ {
+ BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
+ BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
+
+ typedef
+ transform_view<
+ Seq
+ , typename traits::deduce<F>::type
+ , mpl::true_
+ >
+ type;
+ };
+ }
+
+ //TODO boost config macro for default arguments for function templates
+
+ template <typename IsAssociative,typename Seq, typename F>
+ inline typename
+ result_of::transform<
+ BOOST_FUSION_R_ELSE_CLREF(Seq)
+ , BOOST_FUSION_R_ELSE_CLREF(F)
+ , IsAssociative
+ >::type
+ transform(BOOST_FUSION_R_ELSE_CLREF(Seq) seq,
+ BOOST_FUSION_R_ELSE_CLREF(F) f)
+ {
+ return typename
+ result_of::transform<
+ BOOST_FUSION_R_ELSE_CLREF(Seq)
+ , BOOST_FUSION_R_ELSE_CLREF(F)
+ , IsAssociative
+ >::type(BOOST_FUSION_FORWARD(Seq,seq), BOOST_FUSION_FORWARD(F,f));
     }
 
     template <typename Seq, typename F>
@@ -66,6 +113,21 @@
     }
 
 #ifdef BOOST_NO_RVALUE_REFERENCES
+ template <typename IsAssociative,typename Seq, typename F>
+ inline typename result_of::transform<Seq&, F const&>::type
+ transform(Seq& seq, F const& f)
+ {
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4180)
+#endif
+ return typename
+ result_of::transform<Seq&, F const&,IsAssociative>::type(seq, f);
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+ }
+
     template <typename Seq, typename F>
     inline typename result_of::transform<Seq&, F const&>::type
     transform(Seq& seq, F const& f)
@@ -82,6 +144,29 @@
 #endif
 
 #define BOOST_FUSION_TRANSFORM_BINARY(SEQ1_CV_REF_MODIFIER,SEQ2_CV_REF_MODIFIER)\
+ template <typename IsAssociative,typename Seq1, typename Seq2, typename F>\
+ inline typename\
+ result_of::transform<\
+ Seq1 SEQ1_CV_REF_MODIFIER\
+ , Seq2 SEQ2_CV_REF_MODIFIER\
+ , BOOST_FUSION_R_ELSE_CLREF(F)\
+ , IsAssociative\
+ >::type\
+ transform(Seq1 SEQ1_CV_REF_MODIFIER seq1\
+ , Seq2 SEQ2_CV_REF_MODIFIER seq2\
+ , BOOST_FUSION_R_ELSE_CLREF(F) f)\
+ {\
+ return typename\
+ result_of::transform<\
+ Seq1 SEQ1_CV_REF_MODIFIER\
+ , Seq2 SEQ2_CV_REF_MODIFIER\
+ , BOOST_FUSION_R_ELSE_CLREF(F)\
+ , IsAssociative\
+ >::type(BOOST_FUSION_FORWARD(Seq1 SEQ1_CV_REF_MODIFIER,seq1)\
+ , BOOST_FUSION_FORWARD(Seq2 SEQ2_CV_REF_MODIFIER,seq2)\
+ , BOOST_FUSION_FORWARD(F,f));\
+ }\
+ \
     template <typename Seq1, typename Seq2, typename F>\
     inline typename\
         result_of::transform<\

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/advance_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/advance_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/advance_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -29,6 +29,7 @@
                 transform_view_iterator<
                     typename result_of::advance<typename it::it_type, N>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 
@@ -54,6 +55,7 @@
                     typename result_of::advance<typename it::it1_type, N>::type
                   , typename result_of::advance<typename it::it2_type, N>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/begin_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/begin_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/begin_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -34,6 +34,7 @@
                         Seq
                       , typename seq::transform_type
>::type
+ , typename seq::is_associative
>
             type;
 
@@ -62,6 +63,7 @@
                         Seq
                       , typename seq::transform_type
>::type
+ , typename seq::is_associative
>
             type;
 

Added: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_data_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_data_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2009 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_VIEW_TRANSFORM_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
+#define BOOST_FUSION_VIEW_TRANSFORM_VIEW_DETAIL_DEREF_DATA_IMPL_HPP
+
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/support/internal/result_of.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct deref_data_impl;
+
+ // Unary Version
+ template <>
+ struct deref_data_impl<transform_view_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename detail::remove_reference<It>::type it;
+ typedef typename
+ boost::result_of<
+ typename detail::get_func_base<
+ typename it::transform_type
+ >::type(
+ typename result_of::deref<typename it::it_type>::type)
+ >::type
+ result_pair;
+
+ typedef typename
+ detail::forward_as<
+ result_pair
+ , typename detail::remove_reference<
+ result_pair
+ >::type::second_type
+ >::type
+ type;
+
+ static type
+ call(It it)
+ {
+ return (*it.f)(fusion::deref(it.it)).second;
+ }
+ };
+ };
+
+ // Binary Version
+ template <>
+ struct deref_data_impl<transform_view_iterator2_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename detail::remove_reference<It>::type it;
+ typedef typename
+ boost::result_of<
+ typename detail::get_func_base<
+ typename it::transform_type
+ >::type(
+ typename result_of::deref<typename it::it1_type>::type
+ , typename result_of::deref<typename it::it2_type>::type)
+ >::type
+ result_pair;
+
+ typedef typename
+ detail::forward_as<
+ result_pair
+ , typename detail::remove_reference<result_pair>::second_type
+ >::type
+ type;
+
+ static type
+ call(It it)
+ {
+ return (*it.f)
+ (fusion::deref(it.it1), fusion::deref(it.it2)).second;
+ }
+ };
+ };
+}}}
+
+#endif
+

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/deref_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -9,7 +9,6 @@
 #define BOOST_FUSION_VIEW_TRANSFORM_VIEW_DETAIL_DEREF_IMPL_HPP
 
 #include <boost/fusion/iterator/deref.hpp>
-#include <boost/fusion/iterator/value_of.hpp>
 #include <boost/fusion/support/internal/result_of.hpp>
 
 namespace boost { namespace fusion { namespace extension

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/end_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/end_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/end_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -32,6 +32,7 @@
                         Seq
                       , typename seq::transform_type
>::type
+ , typename seq::is_associative
>
             type;
 
@@ -60,6 +61,7 @@
                         Seq
                       , typename seq::transform_type
>::type
+ , typename seq::is_associative
>
             type;
 

Added: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/key_of_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/key_of_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2009 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_VIEW_TRANSFORM_VIEW_DETAIL_KEY_OF_IMPL_HPP
+#define BOOST_FUSION_VIEW_TRANSFORM_VIEW_DETAIL_KEY_OF_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct key_of_impl;
+
+ template <>
+ struct key_of_impl<transform_view_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename
+ value_of_impl<transform_view_iterator_tag>::
+ template apply<It>::type::first_type
+ type;
+ };
+ };
+
+ template <>
+ struct key_of_impl<transform_view_iterator2_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename
+ value_of_impl<transform_view_iterator2_tag>::
+ template apply<It>::first_type
+ type;
+ };
+ };
+}}}
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/next_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/next_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/next_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -30,6 +30,7 @@
                         typename it::it_type
>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 
@@ -59,6 +60,7 @@
                         typename it::it2_type
>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/prior_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/prior_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/prior_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -31,6 +31,7 @@
                         typename it::it_type
>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 
@@ -62,6 +63,7 @@
                         typename it::it2_type
>::type
                   , typename it::transform_type
+ , typename it::is_associative
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/transform_view_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/transform_view_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/transform_view_iterator.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -18,15 +18,33 @@
     // Unary Version
     struct transform_view_iterator_tag;
 
- template <typename It, typename FRef>
+ template <typename It, typename FRef, typename IsAssociative>
     struct transform_view_iterator
- : iterator_base<transform_view_iterator<It, FRef> >
+ : iterator_base<transform_view_iterator<It, FRef, IsAssociative> >
     {
         typedef FRef transform_type;
         typedef It it_type;
+ typedef typename
+ mpl::eval_if<
+ traits::is_random_access<it_type>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::if_<
+ traits::is_bidirectional<it_type>
+ , bidirectional_traversal_tag
+ , forward_traversal_tag
+ >
+ >::type
+ it_category;
+ typedef IsAssociative is_associative;
 
         typedef transform_view_iterator_tag fusion_tag;
- typedef typename traits::category_of<it_type>::type category;
+ typedef typename
+ mpl::eval_if<
+ is_associative
+ , mpl::inherit2<it_category,associative_sequence_tag>
+ , mpl::identity<it_category>
+ >::type
+ category;
 
         template<typename OtherIt>
         transform_view_iterator(BOOST_FUSION_R_ELSE_CLREF(OtherIt) it)
@@ -59,16 +77,32 @@
     // Binary Version
     struct transform_view_iterator2_tag;
 
- template <typename It1, typename It2, typename FRef>
+ template <typename It1, typename It2, typename FRef, typename IsAssociative>
     struct transform_view_iterator2
- : iterator_base<transform_view_iterator2<It1, It2, FRef> >
+ : iterator_base<transform_view_iterator2<It1, It2, FRef, IsAssociative> >
     {
         typedef It1 it1_type;
         typedef It2 it2_type;
         typedef FRef transform_type;
+ typedef typename
+ detail::strictest_traversal<
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+ fusion::vector2<it1_type, it2_type>
+#else
+ fusion::vector<it1_type, it2_type>
+#endif
+ >::type
+ strictest_traversal;
+ typedef IsAssociative is_associative;
 
         typedef transform_view_iterator2_tag fusion_tag;
- typedef typename traits::category_of<it1_type>::type category;
+ typedef typename
+ mpl::eval_if<
+ IsAssociative
+ , mpl::inherit2<strictest_traversal,associative_sequence_tag>
+ , mpl::identity<strictest_traversal>
+ >::type
+ category;
 
         template<typename OtherIt>
         transform_view_iterator2(

Added: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/detail/value_of_data_impl.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2009 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_VIEW_TRANSFORM_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
+#define BOOST_FUSION_VIEW_TRANSFORM_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct value_of_data_impl;
+
+ template <>
+ struct value_of_data_impl<transform_view_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename
+ value_of_impl<transform_view_iterator_tag>::
+ template apply<It>::type::second_type
+ type;
+ };
+ };
+
+ template <>
+ struct value_of_data_impl<transform_view_iterator2_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename
+ value_of_impl<transform_view_iterator2_tag>::
+ template apply<It>::second_type
+ type;
+ };
+ };
+}}}
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -25,6 +25,7 @@
 #include <boost/fusion/view/detail/strictest_traversal.hpp>
 #include <boost/fusion/view/detail/view_storage.hpp>
 
+#include <boost/mpl/if.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/inherit.hpp>
 #include <boost/mpl/identity.hpp>
@@ -42,9 +43,12 @@
 #include <boost/fusion/view/transform_view/detail/begin_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/end_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/deref_impl.hpp>
+#include <boost/fusion/view/transform_view/detail/deref_data_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/next_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/prior_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/value_of_impl.hpp>
+#include <boost/fusion/view/transform_view/detail/value_of_data_impl.hpp>
+#include <boost/fusion/view/transform_view/detail/key_of_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/advance_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/distance_impl.hpp>
 #include <boost/fusion/view/transform_view/detail/equal_to_impl.hpp>
@@ -59,7 +63,7 @@
     //TODO IsAssociative
 
     // Binary Version
- template <typename Seq1, typename Seq2, typename F, typename IsAssociative>
+ template<typename Seq1, typename Seq2, typename F, typename IsAssociative>
     struct transform_view
       : sequence_base<transform_view<Seq1, Seq2, F,IsAssociative> >
     {
@@ -70,6 +74,7 @@
         BOOST_FUSION_MPL_ASSERT((
             mpl::equal_to<result_of::size<Seq1>,result_of::size<Seq2> >));
 
+ typedef IsAssociative is_associative;
         typedef detail::view_storage<Seq1> storage1_type;
         typedef typename storage1_type::type seq1_type;
         typedef detail::view_storage<Seq2> storage2_type;
@@ -90,7 +95,7 @@
         typedef mpl::true_ is_view;
         typedef typename
             mpl::eval_if<
- IsAssociative
+ is_associative
               , mpl::inherit2<strictest_traversal,associative_sequence_tag>
               , mpl::identity<strictest_traversal>
>::type
@@ -148,14 +153,25 @@
         BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
         BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
 
+ typedef IsAssociative is_associative;
         typedef detail::view_storage<Seq> storage_type;
         typedef typename storage_type::type seq_type;
- typedef typename traits::category_of<seq_type>::type seq_category;
+ typedef typename
+ mpl::eval_if<
+ traits::is_random_access<seq_type>
+ , mpl::identity<random_access_traversal_tag>
+ , mpl::if_<
+ traits::is_bidirectional<seq_type>
+ , bidirectional_traversal_tag
+ , forward_traversal_tag
+ >
+ >::type
+ seq_category;
         typedef F transform_type;
 
         typedef typename
             mpl::eval_if<
- IsAssociative
+ is_associative
               , mpl::inherit2<seq_category,associative_sequence_tag>
               , mpl::identity<seq_category>
>::type

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view_fwd.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view_fwd.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/transform_view/transform_view_fwd.hpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -17,10 +17,10 @@
     struct transform_view2_tag;
 
     template<
- typename A
- , typename B
- , typename C = mpl::false_
- , typename D = mpl::false_
+ typename Seq1
+ , typename Seq2
+ , typename F=mpl::false_
+ , typename IsAssociative=mpl::false_
>
     struct transform_view;
 }}

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp 2009-09-14 15:58:20 EDT (Mon, 14 Sep 2009)
@@ -19,88 +19,9 @@
 
 namespace fusion=boost::fusion;
 
-struct dummy
-{
- int i;
-
- dummy()
- : i(0)
- {}
-
- template<typename T>
- dummy(T const& t)
- : i(t.i)
- {}
-
- template<typename T,typename T2>
- dummy(T,T2)
- : i(0)
- {}
-};
-
-struct dummy2
-{
- int i;
-
- dummy2()
- : i(0)
- {}
-
- template<class T>
- dummy2(T const& t)
- : i(t.i)
- {}
-};
-
-void assign_test()
-{
- using namespace fusion;
-
- dummy d;
-
- {
- fusion::pair<int,std::string> a("test");
- }
-
- {
- vector<int> vec(0);
- vector<int> vec2(vec);
- vector<int> vec3(sequence_assign(vec));
- vector<long> vec4(vec);
- }
-
- {
- vector<dummy> vec(d);
- vector<dummy> vec2(vec);
- vector<dummy> vec3(sequence_assign(vec));
- //vector<dummy2> vec4(vec);
- vector<dummy2> vec5(sequence_assign(vec));
- }
-
- {
- vector<int,dummy> vec(0,d);
- vector<int,dummy> vec2(vec);
- vector<int,dummy> vec3(sequence_assign(vec));
- vector<int,dummy2> vec4(vec);
- vector<int,dummy2> vec5(sequence_assign(vec));
- vector<long,dummy2> vec6(vec);
- }
-
- {
- single_view<int> view(0);
- single_view<int> view2(view);
- single_view<int> view3(sequence_assign(view));
- single_view<long> view4(view);
- }
-
- map<pair<int,int> > m(make_pair<int>(0));
-}
-
 #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_NO_VARIADIC_TEMPLATES)
 int main()
-{
- assign_test();
-}
+{}
 #else
 #include <type_traits>
 #include <utility>
@@ -207,9 +128,40 @@
 struct C
 {};
 
+struct make_associative
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename Self, typename Arg>
+ struct result<Self(Arg)>
+ {
+ typedef
+ fusion::pair<
+ typename fusion::detail::remove_reference<Arg>::type
+ , Arg
+ >
+ type;
+ };
+
+ template<typename Arg>
+ typename result<make_associative(Arg&&)>::type
+ operator()(Arg&& arg)
+ {
+ return typename result<make_associative(Arg&&)>::type(arg);
+ }
+};
+
 int main()
 {
- assign_test();
+ {
+ using namespace fusion;
+
+ fusion::at_key<int>(
+ transform<boost::mpl::true_>(
+ make_vector(0,0.0f),
+ make_associative()));
+ }
 
     {
         using namespace fusion;


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