Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62335 - in sandbox/conversion/boost/conversion: . boost std
From: vicente.botet_at_[hidden]
Date: 2010-05-30 15:46:25


Author: viboes
Date: 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
New Revision: 62335
URL: http://svn.boost.org/trac/boost/changeset/62335

Log:
Conversion:
* Update pack function

Text files modified:
   sandbox/conversion/boost/conversion/boost/array.hpp | 7 +++-
   sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 6 ++-
   sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 6 ++-
   sandbox/conversion/boost/conversion/boost/interval.hpp | 3 +
   sandbox/conversion/boost/conversion/boost/optional.hpp | 3 +
   sandbox/conversion/boost/conversion/boost/rational.hpp | 3 +
   sandbox/conversion/boost/conversion/boost/tuple.hpp | 9 ++++--
   sandbox/conversion/boost/conversion/pack.hpp | 60 +++++++++++++++++++++++++++++++++------
   sandbox/conversion/boost/conversion/std/complex.hpp | 1
   sandbox/conversion/boost/conversion/std/pair.hpp | 1
   sandbox/conversion/boost/conversion/std/string.hpp | 1
   sandbox/conversion/boost/conversion/std/vector.hpp | 9 +++--
   12 files changed, 83 insertions(+), 26 deletions(-)

Modified: sandbox/conversion/boost/conversion/boost/array.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/array.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/array.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -44,7 +44,8 @@
     #else
     template < typename T1, typename T2, std::size_t N>
     inline array<T1,N> convert_to(array<T2,N> const & from
- , boost::dummy::type_tag<array<T1,N> > const&)
+ , boost::dummy::type_tag<array<T1,N> > const&
+ )
     {
         array<T1,N> to;
         boost::assign_to(to, from);
@@ -52,7 +53,9 @@
     }
 
     template < typename T1, typename T2, std::size_t N>
- inline array<T1,N>& assign_to(array<T1,N>& to, array<T2,N> const & from, boost::dummy::type_tag<array<T1,N> > const&)
+ inline array<T1,N>& assign_to(array<T1,N>& to, array<T2,N> const & from
+ , boost::dummy::type_tag<array<T1,N> > const&
+ )
     {
         for (unsigned int i =0; i<N; ++i) {
             to[i]=boost::convert_to<T1>(from[i]);

Modified: sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -85,7 +85,8 @@
 
         template < class Rep, class Period>
         inline chrono::duration<Rep, Period> & assign_to(chrono::duration<Rep, Period> & to, const posix_time::time_duration& from
- , boost::dummy::type_tag<chrono::duration<Rep, Period> > const&)
+ , boost::dummy::type_tag<chrono::duration<Rep, Period> > const&
+ )
 
         {
             to = boost::convert_to<duration<Rep, Period> >(from);
@@ -103,7 +104,8 @@
 
         template < class Rep, class Period>
         inline time_duration& assign_to(time_duration& to, const chrono::duration<Rep, Period>& from
- , boost::dummy::type_tag<posix_time::time_duration> const&)
+ , boost::dummy::type_tag<posix_time::time_duration> const&
+ )
         {
             to = boost::convert_to<time_duration>(from);
             return to;

Modified: sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -94,7 +94,8 @@
 
         template < class Clock, class Duration>
         inline chrono::time_point<Clock, Duration>& assign_to(chrono::time_point<Clock, Duration>& to, const posix_time::ptime& from
- , boost::dummy::type_tag<chrono::time_point<Clock, Duration> > const&)
+ , boost::dummy::type_tag<chrono::time_point<Clock, Duration> > const&
+ )
         {
             to = boost::convert_to<chrono::time_point<Clock, Duration> >(from);
             return to;
@@ -114,7 +115,8 @@
 
         template < class Clock, class Duration>
         inline ptime& assign_to(ptime& to, const chrono::time_point<Clock, Duration>& from
- , boost::dummy::type_tag<posix_time::ptime> const&)
+ , boost::dummy::type_tag<posix_time::ptime> const&
+ )
         {
             to = boost::convert_to<ptime>(from);
             return to;

Modified: sandbox/conversion/boost/conversion/boost/interval.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/interval.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/interval.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -46,7 +46,8 @@
         }
         template < class T, class PT, class U, class PU>
         inline interval<T,PT>& assign_to(interval<T,PT>& to, const interval<U,PU>& from
- , boost::dummy::type_tag<interval<T,PT> > const&)
+ , boost::dummy::type_tag<interval<T,PT> > const&
+ )
         {
             to.assign(boost::convert_to<T>(from.lower()),boost::convert_to<U>(from.upper()));
             return to;

Modified: sandbox/conversion/boost/conversion/boost/optional.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/optional.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/optional.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -49,7 +49,8 @@
 
     template < class Target, class Source>
     inline optional<Target>& assign_to(optional<Target>& to, const optional<Source>& from
- , boost::dummy::type_tag<optional<Target> > const&)
+ , boost::dummy::type_tag<optional<Target> > const&
+ )
     {
         to = from?boost::convert_to<Target>(from.get()):optional<Target>();
         return to;

Modified: sandbox/conversion/boost/conversion/boost/rational.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/rational.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/rational.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -47,7 +47,8 @@
 
     template < class T, class U>
     inline rational<T>& assign_to(rational<T>& to, const rational<U>& from
- , boost::dummy::type_tag<rational<T> > const&)
+ , boost::dummy::type_tag<rational<T> > const&
+ )
     {
         to.assign(boost::convert_to<T>(from.numerator()), boost::convert_to<T>(from.denominator()));
         return to;

Modified: sandbox/conversion/boost/conversion/boost/tuple.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/tuple.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/tuple.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -73,7 +73,8 @@
 
     template < class T1, class T2, class U1, class U2>
     inline tuple<T1,T2>& assign_to(tuple<T1,T2>& to, tuple<U1,U2> const & from
- , boost::dummy::type_tag<tuple<T1,T2> > const&)
+ , boost::dummy::type_tag<tuple<T1,T2> > const&
+ )
     {
         to = boost::convert_to<boost::fusion::tuple<T1,T2> >(from);
         return to;
@@ -81,7 +82,8 @@
 
     template < class T1, class T2, class T3, class U1, class U2, class U3>
     inline tuple<T1,T2,T3> convert_to(tuple<U1,U2,U3> const & from
- , boost::dummy::type_tag<tuple<T1,T2,T3> > const&)
+ , boost::dummy::type_tag<tuple<T1,T2,T3> > const&
+ )
     {
         return boost::fusion::tuple<T1,T2, T3>(
                 boost::convert_to<T1>(boost::fusion::get<0>(from))
@@ -92,7 +94,8 @@
 
     template < class T1, class T2, class T3, class U1, class U2, class U3>
     inline tuple<T1,T2,T3> assign_to(tuple<T1,T2,T3>& to, boost::fusion::tuple<U1,U2,U3> const & from
- , boost::dummy::type_tag<tuple<T1,T2,T3> > const&)
+ , boost::dummy::type_tag<tuple<T1,T2,T3> > const&
+ )
     {
         to = boost::convert_to<boost::fusion::tuple<T1,T2> >(from);
         return to;

Modified: sandbox/conversion/boost/conversion/pack.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/pack.hpp (original)
+++ sandbox/conversion/boost/conversion/pack.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -13,27 +13,67 @@
 
 #include <boost/ref.hpp>
 #include <boost/fusion/adapted/std_pair.hpp>
+#include <boost/fusion/tuple.hpp>
 #include <boost/fusion/include/at_c.hpp>
 
 namespace boost { namespace conversion {
     
 
-template <typename T1, typename T2>
-struct result_of_pack {
- typedef std::pair<
- reference_wrapper<T1>, reference_wrapper<T2>
- > type;
-};
+namespace result_of {
+ template <typename T1, typename T2> struct pack2 {
+ typedef
+ std::pair<
+ //~ fusion::tuple<
+ boost::reference_wrapper<T1>
+ , boost::reference_wrapper<T2>
+ > type;
+ };
+ template <typename T1, typename T2, typename T3=fusion::void_> struct pack3 {
+ typedef fusion::tuple<
+ boost::reference_wrapper<T1>
+ , boost::reference_wrapper<T2>
+ , boost::reference_wrapper<T3>
+ > type;
+ };
+}
     
 template <typename T1, typename T2>
-typename result_of_pack<T1 const, T2 const>::type pack(
+typename boost::conversion::result_of::pack2<T1 const, T2 const>::type pack(
         T1 const& t1, T2 const& t2) {
- return std::make_pair(boost::cref(t1), boost::cref(t2));
+ return std::make_pair
+ //~ return boost::fusion::make_tuple
+ (boost::cref(t1), boost::cref(t2));
 }
 
 template <typename T1, typename T2>
-typename result_of_pack<T1 const, T2>::type pack(T1 const& t1, T2 & t2) {
- return std::make_pair(boost::cref(t1), boost::ref(t2));
+typename boost::conversion::result_of::pack2<T1 const, T2>::type pack(T1 const& t1, T2 & t2) {
+ return std::make_pair
+ //~ return boost::fusion::make_tuple
+ (boost::cref(t1), boost::ref(t2));
+}
+
+template <typename T1, typename T2, typename T3>
+typename boost::conversion::result_of::pack3<T1 const, T2 const, T3 const>::type pack(
+ T1 const& t1, T2 const& t2, T3 const& t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::cref(t3));
+}
+
+template <typename T1, typename T2, typename T3>
+typename boost::conversion::result_of::pack3<T1 const, T2 const, T3>::type pack(
+ T1 const& t1, T2 const& t2, T3 & t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::ref(t3));
+}
+
+template <typename T1, typename T2, typename T3>
+typename boost::conversion::result_of::pack3<T1 const, T2, T3 const>::type pack(
+ T1 const& t1, T2 & t2, T3 const& t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::cref(t3));
+}
+
+template <typename T1, typename T2, typename T3>
+typename boost::conversion::result_of::pack3<T1 const, T2, T3>::type pack(
+ T1 const& t1, T2 & t2, T3 & t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::ref(t3));
 }
 
 }}

Modified: sandbox/conversion/boost/conversion/std/complex.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/complex.hpp (original)
+++ sandbox/conversion/boost/conversion/std/complex.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -18,6 +18,7 @@
 namespace boost {
 namespace conversion {
 
+ // std namespace can not be overloaded
     namespace partial_specialization_workaround {
         template < class T, class U>
         struct convert_to< std::complex<T>, std::complex<U> > {

Modified: sandbox/conversion/boost/conversion/std/pair.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/pair.hpp (original)
+++ sandbox/conversion/boost/conversion/std/pair.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -18,6 +18,7 @@
 
 namespace boost { namespace conversion {
 
+ // std namespace can not be overloaded
     namespace partial_specialization_workaround {
         template < class T1, class T2, class U1, class U2>
         struct convert_to< std::pair<T1,T2>, std::pair<U1,U2> > {

Modified: sandbox/conversion/boost/conversion/std/string.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/string.hpp (original)
+++ sandbox/conversion/boost/conversion/std/string.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -19,6 +19,7 @@
 namespace boost {
 namespace conversion {
 
+ // std namespace can not be overloaded
     namespace partial_specialization_workaround {
 
         template<typename T, typename CharT, typename Traits, typename Alloc>

Modified: sandbox/conversion/boost/conversion/std/vector.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/vector.hpp (original)
+++ sandbox/conversion/boost/conversion/std/vector.hpp 2010-05-30 15:46:22 EDT (Sun, 30 May 2010)
@@ -20,6 +20,7 @@
 
 namespace boost { namespace conversion {
 
+ // std namespace can not be overloaded
     namespace partial_specialization_workaround {
         template < class T1, class A1, class T2, class A2>
         struct convert_to< std::vector<T1,A1>, std::vector<T2,A2> > {
@@ -46,16 +47,16 @@
         
         template < class T1, class A1, class T2, class A2>
         struct convert_to< std::vector<T1,A1>,
+ //~ typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
+ //~ boost::fusion::tuple<
                 std::pair<
                     boost::reference_wrapper<std::vector<T2,A2> const>,
                     boost::reference_wrapper<A1 const>
>
> {
             inline static std::vector<T1,A1> apply(
- std::pair<
- boost::reference_wrapper<std::vector<T2,A2> const>,
- boost::reference_wrapper<A1 const>
- > const & pack)
+ typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
+ const & pack)
             {
                 std::vector<T1,A1> res(fusion::at_c<1>(pack));
                 boost::assign_to(res, fusion::at_c<0>(pack).get());


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