Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56115 - in sandbox/SOC/2009/fusion: . boost/fusion/adapted/detail/mpl boost/fusion/algorithm/iteration boost/fusion/algorithm/transformation boost/fusion/algorithm/transformation/detail boost/fusion/container/list boost/fusion/container/vector/detail/pp boost/fusion/container/vector/detail/variadic_templates boost/fusion/support boost/fusion/support/internal boost/fusion/view/single_view libs/fusion/example/test
From: mr.chr.schmidt_at_[hidden]
Date: 2009-09-08 17:41:49


Author: cschmidt
Date: 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
New Revision: 56115
URL: http://svn.boost.org/trac/boost/changeset/56115

Log:
variadic ctors for single_view and pair, gcc 4.4.1 bugfixes
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/distance_impl.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/equal_to_impl.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp | 3
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp | 6 ++
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp | 3
   sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp | 78 ++++++++++++++++++++++++++---------
   sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/pp/vector_n.hpp | 21 +++++++--
   sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp | 31 +++++++++++--
   sandbox/SOC/2009/fusion/boost/fusion/support/internal/ref.hpp | 24 ++++++----
   sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp | 76 +++++++++++++++++------------------
   sandbox/SOC/2009/fusion/boost/fusion/view/single_view/single_view.hpp | 65 +++++++++++++++++++++--------
   sandbox/SOC/2009/fusion/build.bat | 6 +-
   sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp | 86 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2009/fusion/project-root.jam | 4
   14 files changed, 296 insertions(+), 109 deletions(-)

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/distance_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/distance_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/distance_impl.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -9,7 +9,6 @@
 #define BOOST_FUSION_ADAPTED_DETAIL_MPL_DISTANCE_IMPL_HPP
 
 #include <boost/fusion/adapted/detail/mpl/get_mpl_it.hpp>
-
 #include <boost/mpl/distance.hpp>
 
 namespace boost { namespace fusion { namespace extension

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/equal_to_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/equal_to_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/equal_to_impl.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -9,7 +9,6 @@
 #define BOOST_FUSION_ADAPTED_DETAIL_MPL_EQUAL_TO_IMPL_HPP
 
 #include <boost/fusion/adapted/detail/mpl/get_mpl_it.hpp>
-
 #include <boost/type_traits/is_same.hpp>
 
 namespace boost { namespace fusion { namespace extension

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -14,12 +14,13 @@
 #include <boost/fusion/sequence/intrinsic/size.hpp>
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/fusion/support/internal/assert.hpp>
-#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
 
 #ifdef BOOST_NO_RVALUE_REFERENCES
 # include <boost/type_traits/add_const.hpp>
 #endif
 
+#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
+
 namespace boost { namespace fusion
 {
     namespace result_of

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -24,6 +24,11 @@
 
         template<typename Self, typename U>
         struct result<Self(U)>
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ {
+ typedef U type;
+ };
+#else
           : mpl::if_<
                 mpl::and_<
                     is_convertible<
@@ -37,6 +42,7 @@
               , U
>
         {};
+#endif
 
         template<typename OtherF, typename OtherNewValue>
         replace_if_helper(

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -10,11 +10,12 @@
 #define BOOST_FUSION_ALGORITHM_TRANSFORMATION_REPLACE_IF_HPP
 
 #include <boost/fusion/view/transform_view/transform_view.hpp>
-#include <boost/fusion/algorithm/transformation/detail/replace_if.hpp>
 #include <boost/fusion/support/deduce.hpp>
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/fusion/support/internal/assert.hpp>
 
+#include <boost/fusion/algorithm/transformation/detail/replace_if.hpp>
+
 namespace boost { namespace fusion
 {
     namespace result_of

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/list/cons.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -32,6 +32,8 @@
 #ifdef BOOST_NO_RVALUE_REFERENCES
 # include <boost/call_traits.hpp>
 #endif
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
 
 #include <boost/fusion/container/list/detail/cons/cons_fwd.hpp>
 #include <boost/fusion/container/list/detail/cons/at_impl.hpp>
@@ -54,13 +56,14 @@
     struct nil
       : sequence_base<nil>
     {
+ typedef void_ car_type;
+ typedef void_ cdr_type;
+
         typedef mpl::int_<0> size;
         typedef cons_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;
         typedef forward_traversal_tag category;
- typedef void_ car_type;
- typedef void_ cdr_type;
 
         nil()
         {}
@@ -101,15 +104,17 @@
     };
 
     template <typename Car, typename Cdr = nil>
- struct cons : sequence_base<cons<Car, Cdr> >
+ struct cons
+ : sequence_base<cons<Car, Cdr> >
     {
+ typedef Car car_type;
+ typedef Cdr cdr_type;
+
         typedef mpl::int_<Cdr::size::value+1> size;
         typedef cons_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;
         typedef forward_traversal_tag category;
- typedef Car car_type;
- typedef Cdr cdr_type;
 
         cons()
           : car()
@@ -138,19 +143,64 @@
           , cdr(detail::assign_by_deref(),fusion::next(it))
         {}
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+# ifdef BOOST_NO_RVALUE_REFERENCES
         explicit
         cons(typename call_traits<Car>::param_type car)
           : car(car)
         {}
-#else
+
+ cons(typename call_traits<Car>::param_type car,Cdr const& cdr)
+ : car(car)
+ , cdr(cdr)
+ {}
+# else
         template<typename OtherCar>
         explicit
         cons(OtherCar&& car)
           : car(std::forward<OtherCar>(car))
         {}
+
+ template<typename OtherCar,typename OtherCdr>
+ cons(BOOST_FUSION_R_ELSE_CLREF(OtherCar) car,
+ BOOST_FUSION_R_ELSE_CLREF(OtherCdr) cdr)
+ : car(BOOST_FUSION_FORWARD(OtherCar,car))
+ , cdr(BOOST_FUSION_FORWARD(OtherCdr,cdr))
+ {}
+# endif
+#else
+# ifdef BOOST_NO_RVALUE_REFERENCES
+ template<typename... CdrArgs>
+ explicit
+ cons(typename call_traits<Car>::param_type car,
+ CdrArgs... const& cdr_args)
+ : car(car)
+ , cdr(cdr_args)
+ {}
+# else
+ template<typename... CdrArgs>
+ explicit
+ cons(Car&& car,CdrArgs&&... cdr_args)
+ : car(std::forward<Car>(car))
+ , cdr(std::forward<CdrArgs>(cdr_args)...)
+ {}
+# endif
 #endif
 
+ template<typename Seq>
+ cons(
+ BOOST_FUSION_R_ELSE_CLREF(Seq) seq,
+ typename disable_if<
+ is_convertible<BOOST_FUSION_R_ELSE_CLREF(Seq), car_type>
+ >::type* =0)
+ : car(fusion::front(BOOST_FUSION_FORWARD(Seq,seq)))
+ , cdr(detail::assign_by_deref(),
+ fusion::next(fusion::begin(BOOST_FUSION_FORWARD(Seq,seq))))
+ {
+ BOOST_FUSION_MPL_ASSERT_NOT((
+ mpl::equal_to<size,result_of::size<Seq> >));
+ }
+
 #define BOOST_FUSION_CONS_ASSIGN_CTOR(COMBINATION,_)\
         template<typename SeqRef>\
         cons(detail::sequence_assign_type<SeqRef> COMBINATION seq_assign)\
@@ -166,20 +216,6 @@
 
 #undef BOOST_FUSION_CONS_ASSIGN_CTOR
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
- cons(typename call_traits<Car>::param_type car,Cdr const& cdr)
- : car(car)
- , cdr(cdr)
- {}
-#else
- template<typename OtherCar,typename OtherCdr>
- cons(BOOST_FUSION_R_ELSE_CLREF(OtherCar) car,
- BOOST_FUSION_R_ELSE_CLREF(OtherCdr) cdr)
- : car(BOOST_FUSION_FORWARD(OtherCar,car))
- , cdr(BOOST_FUSION_FORWARD(OtherCdr,cdr))
- {}
-#endif
-
         template<typename Seq>
         cons&
         operator=(BOOST_FUSION_R_ELSE_CLREF(Seq) seq)

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/pp/vector_n.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/pp/vector_n.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/pp/vector_n.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -12,6 +12,7 @@
 # include <boost/fusion/sequence/intrinsic/size.hpp>
 # include <boost/fusion/sequence/intrinsic/empty.hpp>
 # endif
+# include <boost/fusion/sequence/intrinsic/front.hpp>
 # include <boost/fusion/sequence/intrinsic/begin.hpp>
 # include <boost/fusion/iterator/deref.hpp>
 # include <boost/fusion/iterator/next.hpp>
@@ -37,9 +38,9 @@
 # ifdef BOOST_FUSION_ENABLE_STATIC_ASSERTS
 # include <boost/mpl/equal_to.hpp>
 # endif
-
+# include <boost/type_traits/is_convertible.hpp>
 # include <boost/type_traits/add_const.hpp>
-//# include <boost/utility/enable_if.hpp>
+# include <boost/utility/enable_if.hpp>
 
 # include <boost/fusion/container/vector/detail/at_impl.hpp>
 # include <boost/fusion/container/vector/detail/value_at_impl.hpp>
@@ -140,6 +141,19 @@
 # undef BOOST_FUSION_VECTOR_CTOR
 
 # if BOOST_FUSION_N
+# if BOOST_FUSION_N==1
+ template<class Seq>
+ explicit
+ vector1(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
+ typename disable_if<
+ is_convertible<BOOST_FUSION_R_ELSE_LREF(Seq), T0>
+ >::type* =0)
+ : m0(fusion::front(seq))
+ {
+ BOOST_FUSION_STATIC_ASSERT((result_of::size<Seq>::value==1));
+ }
+# endif
+
 # define BOOST_FUSION_MEMBER_INIT(Z, N, _)\
         BOOST_PP_CAT(m,N)(\
             BOOST_FUSION_FORWARD(BOOST_PP_CAT(A,N), BOOST_PP_CAT(_,N)))
@@ -147,9 +161,6 @@
 # ifndef BOOST_NO_RVALUE_REFERENCES
         VARIADIC_TEMPLATE_A(BOOST_FUSION_N)
 # endif
-# if (BOOST_FUSION_N == 1)
- explicit
-# endif
         BOOST_PP_CAT(vector, BOOST_FUSION_N)(
 # ifdef BOOST_NO_RVALUE_REFERENCES
             EXPAND_TEMPLATE_ARGUMENTS_CALL_PARAMS(BOOST_FUSION_N)

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/variadic_templates/vector.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -29,9 +29,12 @@
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/mpl/int.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
 #ifdef BOOST_NO_RVALUE_REFERENCES
 # include <boost/call_traits.hpp>
 #endif
+#include <boost/type_traits/is_convertible.hpp>
 #include <boost/utility/enable_if.hpp>
 
 #include <utility>
@@ -42,6 +45,14 @@
 
     namespace detail
     {
+ template<typename From, typename... Elements>
+ struct is_convertible_to_head;
+
+ template<typename From, typename Head, typename... Rest>
+ struct is_convertible_to_head<From, Head, Rest...>
+ : is_convertible<From, Head>
+ {};
+
         template<int Index,typename... Elements>
         struct vector_impl;
 
@@ -316,14 +327,22 @@
 #undef BOOST_FUSION_VECTOR_ASSIGN_CTOR
 
         template<typename Seq>
- vector(
- typename enable_if_c<
- sizeof...(Elements)!=1
- , BOOST_FUSION_R_ELSE_CLREF(Seq)
- >::type seq)
+ vector(BOOST_FUSION_R_ELSE_CLREF(Seq) seq,
+ typename disable_if<
+ mpl::and_<
+ mpl::bool_<sizeof...(Elements)==1>
+ , detail::is_convertible_to_head<
+ BOOST_FUSION_R_ELSE_CLREF(Seq)
+ , Elements...
+ >
+ >
+ >::type* =0)
           : base_type(detail::assign_by_deref(),
                  fusion::begin(BOOST_FUSION_FORWARD(Seq,seq)))
- {}
+ {
+ BOOST_FUSION_STATIC_ASSERT((
+ sizeof...(Elements)==result_of::size<Seq>::value));
+ }
 
         template<typename Seq>
         vector&

Modified: sandbox/SOC/2009/fusion/boost/fusion/support/internal/ref.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/internal/ref.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/internal/ref.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -128,19 +128,25 @@
         typedef T& type;
     };
 
+#ifndef BOOST_NO_RVALUE_REFERENCES
     template <typename T>
- struct identity
+ struct add_lref<T&&>
     {
- typedef typename
-#ifdef BOOST_FUSION_NO_PROPAGATE_VOLATILE
- remove_const<
+ typedef T&& type;
+ };
+#endif
+
+ template <typename T>
+ struct identity
+ :
+ #ifdef BOOST_FUSION_NO_PROPAGATE_VOLATILE
+ remove_const<
 #else
- remove_cv<
+ remove_cv<
 #endif
- typename remove_reference<T>::type
- >::type
- type;
- };
+ typename remove_reference<T>::type
+ >
+ {};
 
     template <typename TestType,typename Type>
     struct forward_as

Modified: sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -13,6 +13,7 @@
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/fusion/support/deduce.hpp>
 
+#include <boost/preprocessor/empty.hpp>
 #if defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(BOOST_NO_RVALUE_REFERENCES)
 # include <boost/call_traits.hpp>
 #endif
@@ -23,59 +24,51 @@
     template <typename First, typename Second>
     struct pair
     {
- pair()
- : second()
- {}
+ typedef First first_type;
+ typedef Second second_type;
 
 #define BOOST_FUSION_PAIR_CTOR(COMBINATION,_)\
- template<typename OtherFirst,typename OtherSecond>\
- pair(pair<OtherFirst,OtherSecond> COMBINATION pair_)\
- : second(static_cast<pair<OtherFirst,OtherSecond> COMBINATION>(pair_)\
- .second)\
+ template<class OtherSecond>\
+ pair(pair<First,OtherSecond> COMBINATION pair_)\
+ : second(static_cast<pair<First,OtherSecond> COMBINATION>\
+ (pair_).second)\
         {}
 
         BOOST_FUSION_ALL_CTOR_COMBINATIONS(BOOST_FUSION_PAIR_CTOR,_)
 
 #undef BOOST_FUSION_PAIR_CTOR
 
-
 #ifdef BOOST_NO_VARIADIC_TEMPLATES
+ pair()
+ : second()
+ {}
+
 # ifdef BOOST_NO_RVALUE_REFERENCES
- pair(typename call_traits<Second>::param_type second)
+ pair(typename call_traits<second_type>::param_type second)
           : second(second)
         {}
 # else
         template<typename Arg>
- pair(Arg&& arg)
+ pair(Arg&& arg);
           : second(std::forward<Arg>(arg))
         {}
 # endif
 #else
- template<typename Arg1,typename... Args>
- pair(Arg1&& arg1, Args&&... args)
- : second(std::forward<Arg1>(arg1),std::forward<Args>(args)...)
+ template<typename... Args>
+ pair(BOOST_FUSION_R_ELSE_CLREF(Args)... args)
+ : second(BOOST_FUSION_FORWARD(Args,args)...)
         {}
 #endif
 
         template <typename Second2>
- pair& operator=(pair<First, Second2> const& rhs)
+ pair& operator=(pair<First, Second2>
+ BOOST_FUSION_R_ELSE_CLREF(BOOST_PP_EMPTY()) rhs)
         {
             second = rhs.second;
             return *this;
         }
 
-#ifndef BOOST_NO_RVALUE_REFERENCES
- template <typename Second2>
- pair& operator=(pair<First, Second2>&& rhs)
- {
- second = std::forward<Second2>(rhs.second);
- return *this;
- }
-#endif
-
- typedef First first_type;
- typedef Second second_type;
- Second second;
+ second_type second;
     };
 
     namespace result_of
@@ -107,10 +100,13 @@
     template <typename First, typename Second>
     inline typename
         result_of::make_pair<First,BOOST_FUSION_R_ELSE_CLREF(Second)>::type
- make_pair(BOOST_FUSION_R_ELSE_CLREF(Second) val)
+ make_pair(BOOST_FUSION_R_ELSE_CLREF(Second) second)
     {
- return typename result_of::
- make_pair<First,BOOST_FUSION_R_ELSE_CLREF(Second)>::type(val);
+ return typename
+ result_of::make_pair<
+ First
+ , BOOST_FUSION_R_ELSE_CLREF(Second)
+ >::type(BOOST_FUSION_FORWARD(Second,second));
     }
 
     template <typename OStream, typename First, typename Second>
@@ -127,26 +123,28 @@
     inline BOOST_FUSION_R_ELSE_LREF(IStream)
     operator>>(
             BOOST_FUSION_R_ELSE_LREF(IStream) is
-#define BOOST_FUSION_ARG pair<First, Second>
- , BOOST_FUSION_R_ELSE_LREF(BOOST_FUSION_ARG) p)
+ , pair<First, Second> BOOST_FUSION_R_ELSE_LREF(BOOST_PP_EMPTY()) p)
     {
- is >> BOOST_FUSION_FORWARD(BOOST_FUSION_ARG,p).second;
-#undef BOOST_FUSION_ARG
+ is >> static_cast<
+ pair<First, Second>BOOST_FUSION_R_ELSE_LREF(BOOST_PP_EMPTY())
+ >(p).second;
         return is;
     }
 
- template <typename First, typename SecondL, typename SecondR>
+ template <typename First, typename SecondLhs, typename SecondRhs>
     inline bool
- operator==(pair<First, SecondL> const& l, pair<First, SecondR> const& r)
+ operator==(pair<First, SecondLhs> const& lhs,
+ pair<First, SecondRhs> const& rhs)
     {
- return l.second == r.second;
+ return lhs.second == rhs.second;
     }
 
- template <typename First, typename SecondL, typename SecondR>
+ template <typename First, typename SecondLhs, typename SecondRhs>
     inline bool
- operator!=(pair<First, SecondL> const& l, pair<First, SecondR> const& r)
+ operator!=(pair<First, SecondLhs> const& lhs,
+ pair<First, SecondRhs> const& rhs)
     {
- return l.second != r.second;
+ return lhs.second != rhs.second;
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/single_view/single_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/single_view/single_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/single_view/single_view.hpp 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -23,6 +23,8 @@
 #ifdef BOOST_NO_RVALUE_REFERENCES
 # include <boost/call_traits.hpp>
 #endif
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/utility/enable_if.hpp>
 
 #include <boost/fusion/view/single_view/detail/single_view_fwd.hpp>
 #include <boost/fusion/view/single_view/detail/single_view_iterator.hpp>
@@ -51,10 +53,6 @@
         typedef mpl::true_ is_view;
         typedef mpl::int_<1> size;
 
- single_view()
- : val()
- {}
-
 #define BOOST_FUSION_SINGLE_VIEW_CTOR(COMBINATION,_)\
         single_view(single_view COMBINATION view)\
           : val(BOOST_FUSION_FORWARD(single_view COMBINATION,view).val)\
@@ -64,19 +62,42 @@
 
 #undef BOOST_FUSION_SINGLE_VIEW_CTOR
 
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+ single_view()
+ : val()
+ {}
+
+# ifdef BOOST_NO_RVALUE_REFERENCES
         explicit
         single_view(typename call_traits<T>::param_type val)
           : val(val)
         {}
+# else
+ template<typename Arg>
+ explicit
+ single_view(Arg&& val);
+ : val(std::forward<Arg>(val))
+ {}
+# endif
 #else
- template<typename OtherT>
+ template<typename... Args>
         explicit
- single_view(OtherT&& val)
- : val(std::forward<OtherT>(val))
+ single_view(BOOST_FUSION_R_ELSE_CLREF(Args)... args)
+ : val(BOOST_FUSION_FORWARD(Args,args)...)
         {}
 #endif
 
+ template<typename Seq>
+ single_view(
+ BOOST_FUSION_R_ELSE_CLREF(Seq) seq,
+ typename disable_if<
+ is_convertible<BOOST_FUSION_R_ELSE_CLREF(Seq), value_type>
+ >::type* =0)
+ : val(fusion::front(BOOST_FUSION_FORWARD(Seq,seq)))
+ {
+ BOOST_FUSION_STATIC_ASSERT((result_of::size<Seq>::value==1));
+ }
+
 #define BOOST_FUSION_SINGLE_VIEW_ASSIGN_CTOR(COMBINATION,_)\
         template<typename SeqRef>\
         single_view(\
@@ -116,19 +137,25 @@
         value_type val;
     };
 
- template <typename T>
- inline single_view<
- typename traits::deduce<BOOST_FUSION_R_ELSE_CLREF(T)>::type
- >
- make_single_view(BOOST_FUSION_R_ELSE_CLREF(T) v)
+ namespace result_of
     {
- typedef
- single_view<
- typename traits::deduce<BOOST_FUSION_R_ELSE_CLREF(T)>::type
- >
- view;
+ template<typename T>
+ struct make_single_view
+ {
+ typedef
+ single_view<
+ typename traits::deduce<BOOST_FUSION_R_ELSE_CLREF(T)>::type
+ >
+ type;
+ };
+ };
 
- return view(BOOST_FUSION_FORWARD(T,v));
+ template <typename T>
+ inline typename result_of::make_single_view<T>::type
+ make_single_view(BOOST_FUSION_R_ELSE_CLREF(T) val)
+ {
+ return typename result_of::make_single_view<T>::type(
+ BOOST_FUSION_FORWARD(T,val));
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/build.bat
==============================================================================
--- sandbox/SOC/2009/fusion/build.bat (original)
+++ sandbox/SOC/2009/fusion/build.bat 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -8,8 +8,8 @@
 rem ===========================================================================
 
 rem (re-)set environment variables
-set BOOST_ROOT=d:/projekte/libs/boost
-set BOOST_INCLUDES_PATH=%BOOST_ROOT%/include/boost-1_40
+set BOOST_ROOT=d:/projekte/libs/boost/src
+set BOOST_INCLUDES_PATH=d:/projekte/libs/boost/bin/include/boost-1_41
 
 rem call toolset specific procedure
 if "%1" == "gcc4" (
@@ -22,7 +22,7 @@
             call :gcc3
         ) else (
             if "%1" == "" (
- call :gcc4
+ call :vc9
             ) else (
                 echo Unknown toolset '%1'
                 goto :eof

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-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -19,9 +19,88 @@
 
 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>
@@ -125,8 +204,13 @@
     }
 };
 
+struct C
+{};
+
 int main()
 {
+ assign_test();
+
     {
         using namespace fusion;
 

Modified: sandbox/SOC/2009/fusion/project-root.jam
==============================================================================
--- sandbox/SOC/2009/fusion/project-root.jam (original)
+++ sandbox/SOC/2009/fusion/project-root.jam 2009-09-08 17:41:47 EDT (Tue, 08 Sep 2009)
@@ -14,12 +14,12 @@
                    <include>$(BOOST_INCLUDES_PATH)
                    <define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
 # <define>BOOST_FUSION_PREFER_MPL
- <toolset>gcc:<cxxflags>-std=c++0x
+# <toolset>gcc:<cxxflags>-std=c++0x
     : build-dir ../bin
     : default-build debug <link>shared <runtime-link>shared <threading>multi
     ;
 
-#build-project libs/fusion/example/test ;
+build-project libs/fusion/example/test ;
 
 #build-project libs/fusion/doc ;
 #build-project libs/fusion/example/extension ;


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