Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72344 - in sandbox/conversion/boost/conversion: . boost fp std
From: vicente.botet_at_[hidden]
Date: 2011-06-02 10:26:38


Author: viboes
Date: 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
New Revision: 72344
URL: http://svn.boost.org/trac/boost/changeset/72344

Log:
Conversion: cleanup
Text files modified:
   sandbox/conversion/boost/conversion/assign_to.hpp | 37 ++++++++-------
   sandbox/conversion/boost/conversion/boost/array.hpp | 60 ++++++++++++-------------
   sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 73 +++++++++++++++----------------
   sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 92 +++++++++++++++++++--------------------
   sandbox/conversion/boost/conversion/boost/interval.hpp | 56 ++++++++++++------------
   sandbox/conversion/boost/conversion/boost/optional.hpp | 60 +++++++++++++-------------
   sandbox/conversion/boost/conversion/boost/rational.hpp | 49 ++++++++++----------
   sandbox/conversion/boost/conversion/boost/tuple.hpp | 73 +++++++++++++++----------------
   sandbox/conversion/boost/conversion/convert_to.hpp | 42 +++++++++---------
   sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 34 +++++++++-----
   sandbox/conversion/boost/conversion/convert_to_via.hpp | 6 +-
   sandbox/conversion/boost/conversion/fp/convert_to.hpp | 20 ++++----
   sandbox/conversion/boost/conversion/std/complex.hpp | 47 ++++++++++----------
   sandbox/conversion/boost/conversion/std/pair.hpp | 37 ++++++++-------
   sandbox/conversion/boost/conversion/std/string.hpp | 71 ++++++++++++++++--------------
   sandbox/conversion/boost/conversion/std/vector.hpp | 84 ++++++++++++++++++-----------------
   sandbox/conversion/boost/conversion/try_assign_to.hpp | 57 +++++++++++++----------
   sandbox/conversion/boost/conversion/try_convert_to.hpp | 53 +++++++++++++----------
   18 files changed, 487 insertions(+), 464 deletions(-)

Modified: sandbox/conversion/boost/conversion/assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/assign_to.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -31,34 +31,35 @@
 
 namespace boost {
   namespace conversion {
- //! struct used when overloading can not be applied.
- //! @tparam To target type of the conversion.
- //! @tparam From source type of the conversion.
- //! @tparam Enable A dummy parameter that can be used for SFINAE.
- template < typename To, typename From, class Enable = void>
+ //! Customization point for @assign_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ template < typename Target, typename Source, class Enable = void>
     struct assigner
     {
+ //! @Requires @c Target must be CopyAssinable and @c ::boost::conversion::convert_to<Target>(from) must be well formed.
       //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
- //! @Throws Whatever the underlying assignment operator of the @c To class throws.
- To& operator()(To& to, const From& from)
+ //! @Throws Whatever the underlying assignment operator of the @c Target class throws.
+ Target& operator()(Target& to, const Source& from)
       {
- to = ::boost::conversion::convert_to<To>(from);
+ to = ::boost::conversion::convert_to<Target>(from);
         return to;
       }
     };
 
     //! partial specialization for c-array types.
- template < typename To, typename From, std::size_t N >
- struct assigner<To[N],From[N],void>
+ template < typename Target, typename Source, std::size_t N >
+ struct assigner<Target[N],Source[N],void>
     {
       //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator on each one of the array elements.
- //! @Throws Whatever the underlying assignment operator of the @c To class throws.
+ //! @Throws Whatever the underlying assignment operator of the @c Target class throws.
       //! @Basic
- To*& operator()(To(&to)[N], const From(& from)[N])
+ Target*& operator()(Target(&to)[N], const Source(& from)[N])
       {
         for (std::size_t i = 0; i < N; ++i)
         {
- to[i] = ::boost::conversion::convert_to<To>(from[i]);
+ to[i] = ::boost::conversion::convert_to<Target>(from[i]);
         }
         return to;
       }
@@ -71,12 +72,12 @@
     //! @brief Default @c assign_to overload, used when ADL fails.
     //!
     //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
- //! @Throws Whatever the underlying the assignment operator of the @c To class throws.
+ //! @Throws Whatever the underlying the assignment operator of the @c Target class throws.
     //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- To& assign_to(To& to, const From& from)
+ template < typename Target, typename Source >
+ Target& assign_to(Target& to, const Source& from)
     {
- return conversion::assigner<To,From>()(to, from);
+ return conversion::assigner<Target,Source>()(to, from);
     }
   }
 
@@ -101,7 +102,7 @@
     //! @Param{from,source of the conversion}
 
     //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
- //! @Throws Whatever the underlying the assignment operator of the @c To class throws..
+ //! @Throws Whatever the underlying the assignment operator of the @c Target class throws..
     //! This function can be overloaded by the user.
 
     template <typename Target, typename Source>

Modified: sandbox/conversion/boost/conversion/boost/array.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/array.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/array.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -24,39 +24,38 @@
 #include <boost/config.hpp>
 
 namespace boost {
-
   namespace conversion {
 
- /**
- * Partial specialization of @c convert_to for @c boost::array of the same size
- */
- template < typename T1, typename T2, std::size_t N>
- struct converter< array<T1,N>, array<T2,N> >
+ /**
+ * Partial specialization of @c converter for @c boost::array of the same size
+ */
+ template < typename Target, typename Source, std::size_t N>
+ struct converter< array<Target,N>, array<Source,N> >
+ {
+ //! @Returns the array having as elements the result of the conversion of each one of the source array elements.
+ inline array<Target,N> operator()(array<Source,N> const & from)
       {
- //! @Returns the array having as elements the result of the conversion of each one of the source array elements.
- inline array<T1,N> operator()(array<T2,N> const & from)
- {
- array<T1,N> to;
- boost::conversion::assign_to(to, from);
- return to;
- }
- };
- /**
- * Partial specialization of @c assign_to for @c boost::array of the same size
- */
- template < typename T1, typename T2, std::size_t N>
- struct assigner< array<T1,N>, array<T2,N> >
+ array<Target,N> to;
+ boost::conversion::assign_to(to, from);
+ return to;
+ }
+ };
+ /**
+ * Partial specialization of @c assigner for @c boost::array of the same size
+ */
+ template < typename Target, typename Source, std::size_t N>
+ struct assigner< array<Target,N>, array<Source,N> >
+ {
+ //! @Effects assign to each one of the target array elements the conversion of the source array element.
+ array<Target,N>& operator()(array<Target,N>& to, array<Source,N> const & from)
       {
- //! @Effects assign to each one of the target array elements the conversion of the source array element.
- array<T1,N>& operator()(array<T1,N>& to, array<T2,N> const & from)
+ for (unsigned int i =0; i<N; ++i)
         {
- for (unsigned int i =0; i<N; ++i)
- {
- to[i]=boost::conversion::convert_to<T1>(from[i]);
- }
- return to;
+ to[i]=boost::conversion::convert_to<Target>(from[i]);
         }
- };
+ return to;
+ }
+ };
   }
 
   #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
@@ -64,11 +63,10 @@
   //!
   //! @Effects converts each one of the source array elements and store the result in the corresponding index on the target array.
   //! @Returns The @c to parameter reference.
- template < typename T1, typename T2, std::size_t N>
- inline array<T1,N>& assign_to(array<T1,N>& to, array<T2,N> const & from
- )
+ template < typename Target, typename Source, std::size_t N>
+ inline array<Target,N>& assign_to(array<Target,N>& to, array<Source,N> const & from)
   {
- return conversion::assigner<array<T1,N>, array<T2,N> >()(to, from);
+ return conversion::assigner<array<Target,N>, array<Source,N> >()(to, from);
   }
   #endif
 }

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 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -25,38 +25,40 @@
 
 namespace boost {
   namespace conversion {
- //! @brief @c convert_to specialization for conversions from @c boost::chrono::duration<> to @c boost::posix_time::time_duration.
- //!
- template < class Rep, class Period>
- struct converter<posix_time::time_duration, chrono::duration<Rep, Period> > {
- //! @Returns the duration converted to seconds+nanoseconds following the boost::posix_time::time_duration formatting.
- posix_time::time_duration operator()(chrono::duration<Rep, Period> const & from)
- {
- typedef chrono::duration<Rep, Period> src_duration_t;
- typedef chrono::nanoseconds duration_t;
- typedef duration_t::rep rep_t;
- rep_t d = chrono::duration_cast<duration_t>(from).count();
- rep_t sec = d/1000000000;
- rep_t nsec = d%1000000000;
- return posix_time::seconds(static_cast<long long>(sec))+
- #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
- posix_time::nanoseconds(nsec);
- #else
- posix_time::microseconds((nsec+500)/1000);
- #endif
- }
- };
- //! @brief @c convert_to overloading for conversions from @c boost::posix_time::time_duration to @c boost::chrono::duration<>.
- //!
-
- template < class Rep, class Period>
- struct converter<chrono::duration<Rep, Period>, posix_time::time_duration> {
- //! @Returns the duration cast from a nanoseconds duration initialized to the total number of nanosecond of the @c from parameter.
- chrono::duration<Rep, Period> operator()(posix_time::time_duration const & from)
- {
- return chrono::duration_cast<chrono::duration<Rep, Period> >(chrono::nanoseconds(from.total_nanoseconds()));
- }
- };
+ //! @brief @c converter specialization for conversions from @c boost::chrono::duration<> to @c boost::posix_time::time_duration.
+ //!
+ template < class Rep, class Period>
+ struct converter<posix_time::time_duration, chrono::duration<Rep, Period> >
+ {
+ //! @Returns the duration converted to seconds+nanoseconds following the boost::posix_time::time_duration formatting.
+ posix_time::time_duration operator()(chrono::duration<Rep, Period> const & from)
+ {
+ typedef chrono::duration<Rep, Period> src_duration_t;
+ typedef chrono::nanoseconds duration_t;
+ typedef duration_t::rep rep_t;
+ rep_t d = chrono::duration_cast<duration_t>(from).count();
+ rep_t sec = d/1000000000;
+ rep_t nsec = d%1000000000;
+ return posix_time::seconds(static_cast<long long>(sec))+
+ #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
+ posix_time::nanoseconds(nsec);
+ #else
+ posix_time::microseconds((nsec+500)/1000);
+ #endif
+ }
+ };
+ //! @brief @c converter specialization for conversions from @c boost::posix_time::time_duration to @c boost::chrono::duration<>.
+ //!
+
+ template < class Rep, class Period>
+ struct converter<chrono::duration<Rep, Period>, posix_time::time_duration>
+ {
+ //! @Returns the duration cast from a nanoseconds duration initialized to the total number of nanosecond of the @c from parameter.
+ chrono::duration<Rep, Period> operator()(posix_time::time_duration const & from)
+ {
+ return chrono::duration_cast<chrono::duration<Rep, Period> >(chrono::nanoseconds(from.total_nanoseconds()));
+ }
+ };
 
   }
 
@@ -69,9 +71,7 @@
     //! @Returns The @c to parameter reference.
 
     template < class Rep, class Period>
- inline chrono::duration<Rep, Period> & assign_to(chrono::duration<Rep, Period> & to, const posix_time::time_duration& from
- )
-
+ inline chrono::duration<Rep, Period> & assign_to(chrono::duration<Rep, Period> & to, const posix_time::time_duration& from)
     {
         to = boost::conversion::convert_to<duration<Rep, Period> >(from);
         return to;
@@ -85,8 +85,7 @@
     //! @Effects As if <c>to = boost::conversion::convert_to<time_duration>(from)</c>.
     //! @Returns The @c to parameter reference.
     template < class Rep, class Period>
- inline time_duration& assign_to(time_duration& to, const chrono::duration<Rep, Period>& from
- )
+ inline time_duration& assign_to(time_duration& to, const chrono::duration<Rep, Period>& from)
     {
         to = boost::conversion::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 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -26,62 +26,60 @@
 #include <boost/config.hpp>
 
 namespace boost {
- namespace conversion {
- template < class Clock, class Duration>
- struct converter<posix_time::ptime, chrono::time_point<Clock, Duration> > {
- posix_time::ptime operator()(const chrono::time_point<Clock, Duration>& from)
- {
- typedef chrono::time_point<Clock, Duration> time_point_t;
- typedef chrono::nanoseconds duration_t;
- typedef duration_t::rep rep_t;
- rep_t d = chrono::duration_cast<duration_t>(from.time_since_epoch()).count();
- rep_t sec = d/1000000000;
- rep_t nsec = d%1000000000;
- return posix_time::from_time_t(0)+
- posix_time::seconds(static_cast<long>(sec))+
+ namespace conversion {
+ template < class Clock, class Duration>
+ struct converter<posix_time::ptime, chrono::time_point<Clock, Duration> >
+ {
+ posix_time::ptime operator()(const chrono::time_point<Clock, Duration>& from)
+ {
+ typedef chrono::time_point<Clock, Duration> time_point_t;
+ typedef chrono::nanoseconds duration_t;
+ typedef duration_t::rep rep_t;
+ rep_t d = chrono::duration_cast<duration_t>(from.time_since_epoch()).count();
+ rep_t sec = d/1000000000;
+ rep_t nsec = d%1000000000;
+ return posix_time::from_time_t(0)+
+ posix_time::seconds(static_cast<long>(sec))+
 #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
- posix_time::nanoseconds(nsec);
+ posix_time::nanoseconds(nsec);
 #else
- posix_time::microseconds((nsec+500)/1000);
+ posix_time::microseconds((nsec+500)/1000);
 #endif
- }
- };
+ }
+ };
 
- template < class Clock, class Duration>
- struct converter<chrono::time_point<Clock, Duration>, posix_time::ptime> {
- chrono::time_point<Clock, Duration> operator()(const posix_time::ptime& from)
- {
- posix_time::time_duration const time_since_epoch=from-posix_time::from_time_t(0);
- chrono::time_point<Clock, Duration> t=chrono::system_clock::from_time_t(time_since_epoch.total_seconds());
- long long nsec=time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second());
- return t+chrono::duration_cast<Duration>(chrono::nanoseconds(nsec));
- }
- };
- }
+ template < class Clock, class Duration>
+ struct converter<chrono::time_point<Clock, Duration>, posix_time::ptime>
+ {
+ chrono::time_point<Clock, Duration> operator()(const posix_time::ptime& from)
+ {
+ posix_time::time_duration const time_since_epoch=from-posix_time::from_time_t(0);
+ chrono::time_point<Clock, Duration> t=chrono::system_clock::from_time_t(time_since_epoch.total_seconds());
+ long long nsec=time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second());
+ return t+chrono::duration_cast<Duration>(chrono::nanoseconds(nsec));
+ }
+ };
+ }
 
 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- namespace chrono {
- template < class Clock, class Duration>
- inline chrono::time_point<Clock, Duration>& assign_to(chrono::time_point<Clock, Duration>& to, const posix_time::ptime& from
- )
- {
- to = boost::conversion::convert_to<chrono::time_point<Clock, Duration> >(from);
- return to;
- }
-
+ namespace chrono {
+ template < class Clock, class Duration>
+ inline chrono::time_point<Clock, Duration>& assign_to(chrono::time_point<Clock, Duration>& to, const posix_time::ptime& from)
+ {
+ to = boost::conversion::convert_to<chrono::time_point<Clock, Duration> >(from);
+ return to;
     }
+ }
 
- namespace posix_time {
- template < class Clock, class Duration>
- inline ptime& assign_to(ptime& to, const chrono::time_point<Clock, Duration>& from
- )
- {
- to = boost::conversion::convert_to<ptime>(from);
- return to;
- }
-
+ namespace posix_time {
+ template < class Clock, class Duration>
+ inline ptime& assign_to(ptime& to, const chrono::time_point<Clock, Duration>& from)
+ {
+ to = boost::conversion::convert_to<ptime>(from);
+ return to;
     }
- #endif
+ }
+#endif
 }
 
 #endif

Modified: sandbox/conversion/boost/conversion/boost/interval.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/interval.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/interval.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -22,36 +22,36 @@
 #include <boost/conversion/assign_to.hpp>
 
 namespace boost {
-
- namespace conversion {
- //! @brief @c convert_to specialization for source and target been @c boost::numeric::interval.
- //!
- template < class T, class PT, class U, class PU>
- struct converter< numeric::interval<T,PT>, numeric::interval<U,PU> > {
- //! @Returns the target interval having as extremes the conversion from the source interval extremes.
- numeric::interval<T,PT> operator()(numeric::interval<U,PU> const & from)
- {
- return numeric::interval<T,PT>(boost::conversion::convert_to<T>(from.lower()), boost::conversion::convert_to<U>(from.upper()));
- }
- };
- template < class T, class PT, class U, class PU>
- struct assigner< numeric::interval<T,PT>, numeric::interval<U,PU> > {
- numeric::interval<T,PT>& operator()(numeric::interval<T,PT>& to, const numeric::interval<U,PU>& from)
- {
- to.assign(boost::conversion::convert_to<T>(from.lower()), boost::conversion::convert_to<U>(from.upper()));
- return to;
- }
- };
- }
+ namespace conversion {
+ //! @brief @c converter specialization for source and target been @c boost::numeric::interval.
+ //!
+ template < class Target, class PTarget, class Source, class PSource>
+ struct converter< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >
+ {
+ //! @Returns the target interval having as extremes the conversion from the source interval extremes.
+ numeric::interval<Target,PTarget> operator()(numeric::interval<Source,PSource> const & from)
+ {
+ return numeric::interval<Target,PTarget>(boost::conversion::convert_to<Target>(from.lower()), boost::conversion::convert_to<Source>(from.upper()));
+ }
+ };
+ template < class Target, class PTarget, class Source, class PSource>
+ struct assigner< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >
+ {
+ numeric::interval<Target,PTarget>& operator()(numeric::interval<Target,PTarget>& to, const numeric::interval<Source,PSource>& from)
+ {
+ to.assign(boost::conversion::convert_to<Target>(from.lower()), boost::conversion::convert_to<Source>(from.upper()));
+ return to;
+ }
+ };
+ }
 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- namespace numeric {
- template < class T, class PT, class U, class PU>
- inline interval<T,PT>& assign_to(interval<T,PT>& to, const interval<U,PU>& from
- )
- {
- return conversion::assigner<interval<T,PT>, interval<U,PU> >()(to, from);
- }
+ namespace numeric {
+ template < class Target, class PTarget, class Source, class PSource>
+ inline interval<Target,PTarget>& assign_to(interval<Target,PTarget>& to, const interval<Source,PSource>& from)
+ {
+ return conversion::assigner<interval<Target,PTarget>, interval<Source,PSource> >()(to, from);
     }
+ }
 #endif
 }
 

Modified: sandbox/conversion/boost/conversion/boost/optional.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/optional.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/optional.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -41,41 +41,41 @@
 #endif
 
   namespace conversion {
- /**
- * Partial specialization of @c convert_to for boost::optional
- */
- template < class Target, class Source>
- struct converter< optional<Target>, optional<Source> >
+ /**
+ * Partial specialization of @c converter for boost::optional
+ */
+ template < class Target, class Source>
+ struct converter< optional<Target>, optional<Source> >
+ {
+ //! @Returns If the optional source is initialized @c boost::optional<Target> initialized to the conversion of the optional value.
+ //! Uninitialized @c boost::optional<Target otherwise.
+ optional<Target> operator()(optional<Source> const & from)
       {
- //! @Returns If the optional source is initialized @c boost::optional<Target> initialized to the conversion of the optional value.
- //! Uninitialized @c boost::optional<Target otherwise.
- optional<Target> operator()(optional<Source> const & from)
+ return (from?optional<Target>(boost::conversion::convert_to<Target>(from.get())):optional<Target>());
+ }
+ };
+
+ //! @brief @c converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
+ //!
+ //! We can see this specialization as a try_convert_to function.
+ template < class Target, class Source>
+ struct converter< optional<Target>, Source>
+ {
+ //! @Returns If the source is convertible to the target @c value_type
+ //! @c Target initialized to the result of the conversion.
+ //! Uninitialized @c Target otherwise.
+ optional<Target> operator()(Source const & from)
+ {
+ try
         {
- return (from?optional<Target>(boost::conversion::convert_to<Target>(from.get())):optional<Target>());
+ return optional<Target>(boost::conversion::convert_to<Target>(from));
         }
- };
-
- //! @brief @c convert_to specialization to try to convert the source to @c Target::value_type when @c Target is optional.
- //!
- //! We can see this specialization as a try_convert_to function.
- template < class Target, class Source>
- struct converter< optional<Target>, Source>
- {
- //! @Returns If the source is convertible to the target @c value_type
- //! @c Target initialized to the result of the conversion.
- //! Uninitialized @c Target otherwise.
- optional<Target> operator()(Source const & from)
+ catch (...)
         {
- try
- {
- return optional<Target>(boost::conversion::convert_to<Target>(from));
- }
- catch (...)
- {
- return optional<Target>();
- }
+ return optional<Target>();
         }
- };
+ }
+ };
 
 
   }

Modified: sandbox/conversion/boost/conversion/boost/rational.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/rational.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/rational.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -25,36 +25,35 @@
 #include <boost/utility/enable_if.hpp>
 
 namespace boost {
-
   namespace conversion {
- //! @brief @c convert_to specialization for source and target been @c boost::rational.
- //!
- template < class T, class U>
- struct converter< rational<T>, rational<U> > {
- //! @Returns the target rational having as numerator and denominator the conversion from the numerator and denominator of the source rational.
- rational<T> operator()(rational<U> const & from)
- {
- return rational<T>(boost::conversion::convert_to<T>(from.numerator()), boost::conversion::convert_to<T>(from.denominator()));
- }
- };
- template < class T, class U>
- struct assigner< rational<T>, rational<U> >
+ //! @brief @c converter specialization for source and target been @c boost::rational.
+ //!
+ template < class Target, class Source>
+ struct converter< rational<Target>, rational<Source> >
+ {
+ //! @Returns the target rational having as numerator and denominator the conversion from the numerator and denominator of the source rational.
+ rational<Target> operator()(rational<Source> const & from)
       {
- rational<T>& operator()(rational<T>& to, const rational<U>& from)
- {
- to.assign(boost::conversion::convert_to<T>(from.numerator()), boost::conversion::convert_to<T>(from.denominator()));
- return to;
- }
- };
-
+ return rational<Target>(boost::conversion::convert_to<Target>(from.numerator()), boost::conversion::convert_to<Target>(from.denominator()));
+ }
+ };
+ template < class Target, class Source>
+ struct assigner< rational<Target>, rational<Source> >
+ {
+ rational<Target>& operator()(rational<Target>& to, const rational<Source>& from)
+ {
+ to.assign(boost::conversion::convert_to<Target>(from.numerator()), boost::conversion::convert_to<Target>(from.denominator()));
+ return to;
+ }
+ };
   }
 
 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- template < class T, class U>
- inline rational<T>& assign_to(rational<T>& to, const rational<U>& from)
- {
- return conversion::assigner<rational<T>, rational<U> >()(to, from);
- }
+ template < class Target, class Source>
+ inline rational<Target>& assign_to(rational<Target>& to, const rational<Source>& from)
+ {
+ return conversion::assigner<rational<Target>, rational<Source> >()(to, from);
+ }
 #endif
 
 }

Modified: sandbox/conversion/boost/conversion/boost/tuple.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/tuple.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/tuple.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -22,56 +22,55 @@
 #include <boost/config.hpp>
 
 namespace boost {
-
   namespace conversion {
- template < class T1, class T2, class U1, class U2>
- struct converter< fusion::tuple<T1,T2>, fusion::tuple<U1,U2> > {
- fusion::tuple<T1,T2> operator()(fusion::tuple<U1,U2> const & from)
- {
- return fusion::tuple<T1,T2>(
- boost::conversion::convert_to<T1>(fusion::get<0>(from))
- , boost::conversion::convert_to<T2>(fusion::get<1>(from))
- );
- }
- };
- template < class T1, class T2, class T3, class U1, class U2, class U3>
- struct converter< fusion::tuple<T1,T2,T3>, fusion::tuple<U1,U2,U3> > {
- fusion::tuple<T1,T2,T3> operator()(fusion::tuple<U1,U2,U3> const & from)
- {
- return fusion::tuple<T1,T2, T3>(
- boost::conversion::convert_to<T1>(fusion::get<0>(from))
- , boost::conversion::convert_to<T2>(fusion::get<1>(from))
- , boost::conversion::convert_to<T3>(fusion::get<2>(from))
- );
- }
- };
+ template < class T1, class T2, class S1, class S2>
+ struct converter< fusion::tuple<T1,T2>, fusion::tuple<S1,S2> >
+ {
+ fusion::tuple<T1,T2> operator()(fusion::tuple<S1,S2> const & from)
+ {
+ return fusion::tuple<T1,T2>(
+ boost::conversion::convert_to<T1>(fusion::get<0>(from))
+ , boost::conversion::convert_to<T2>(fusion::get<1>(from))
+ );
+ }
+ };
+ template < class T1, class T2, class T3, class S1, class S2, class S3>
+ struct converter< fusion::tuple<T1,T2,T3>, fusion::tuple<S1,S2,S3> >
+ {
+ fusion::tuple<T1,T2,T3> operator()(fusion::tuple<S1,S2,S3> const & from)
+ {
+ return fusion::tuple<T1,T2, T3>(
+ boost::conversion::convert_to<T1>(fusion::get<0>(from))
+ , boost::conversion::convert_to<T2>(fusion::get<1>(from))
+ , boost::conversion::convert_to<T3>(fusion::get<2>(from))
+ );
+ }
+ };
 
   }
 
 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- namespace fusion {
+ namespace fusion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- template < class... Target, class... Source>
- inline tuple<Target...>& assign_to(tuple<Target...>& to, tuple<Source...> const & from
- )
+ template < class... Target, class... Source>
+ inline tuple<Target...>& assign_to(tuple<Target...>& to, tuple<Source...> const & from
+ );
 #else
 
- template < class T1, class T2, class U1, class U2>
- inline tuple<T1,T2>& assign_to(tuple<T1,T2>& to, tuple<U1,U2> const & from
- )
+ template < class T1, class T2, class S1, class S2>
+ inline tuple<T1,T2>& assign_to(tuple<T1,T2>& to, tuple<S1,S2> const & from)
     {
- to = boost::conversion::convert_to<boost::fusion::tuple<T1,T2> >(from);
- return to;
+ to = boost::conversion::convert_to<boost::fusion::tuple<T1,T2> >(from);
+ return to;
     }
 
- 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
- )
+ template < class T1, class T2, class T3, class S1, class S2, class S3>
+ inline tuple<T1,T2,T3> assign_to(tuple<T1,T2,T3>& to, boost::fusion::tuple<S1,S2,S3> const & from)
     {
- to = boost::conversion::convert_to<boost::fusion::tuple<T1,T2> >(from);
- return to;
- }
+ to = boost::conversion::convert_to<boost::fusion::tuple<T1,T2> >(from);
+ return to;
     }
+ }
 #endif
 #endif
 }

Modified: sandbox/conversion/boost/conversion/convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -11,9 +11,9 @@
  * @file
  * @brief Defines the free function @c convert_to.
  *
- * The @c convert_to function converts the @c from parameter to a @c To type.
- * The default implementation applies the conversion @c To operator of the @c From class or
- * the copy constructor of the @c To class.
+ * The @c convert_to function converts the @c from parameter to a @c Target type.
+ * The default implementation applies the conversion @c Target operator of the @c Source class or
+ * the copy constructor of the @c Target class.
  * Of course if both exist the conversion is ambiguous.
  *
  * A user adapting another type could need to overload the @c convert_to free function
@@ -58,19 +58,19 @@
     template <typename T, typename Enabled=void>
     struct enable_functor : mpl::false_ {};
 
- //! customization point for @convert_to.
-
- //! @tparam To target type of the conversion.
- //! @tparam From source type of the conversion.
- //! @tparam Enable A dummy parameter that can be used for SFINAE.
+ //! Customization point for @convert_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
 
- template < typename To, typename From, class Enable = void >
+ template < typename Target, typename Source, class Enable = void >
     struct converter {
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
- //! @Throws Whatever the underlying conversion @c To operator of the @c From class or the copy constructor of the @c To class throws.
- To operator()(const From& val)
+ //! @Requires @c Target must be CopyConstructible from @c Source or @c Source convertible to @c Target
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
+ //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class or the copy constructor of the @c Target class throws.
+ Target operator()(const Source& val)
       {
- return To((val));
+ return Target((val));
       }
     };
 #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
@@ -78,12 +78,12 @@
 
       //! @brief Default @c convert_to overload, used when ADL fails.
       //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
- //! @Throws Whatever the underlying conversion @c To operator of the @c From class or the copy constructor of the @c To class throws.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
+ //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class or the copy constructor of the @c Target class throws.
       //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- To convert_to(const From& from, dummy::type_tag<To> const&) {
- return conversion::converter<To,From>()(from);
+ template < typename Target, typename Source >
+ Target convert_to(const Source& from, dummy::type_tag<Target> const&) {
+ return conversion::converter<Target,Source>()(from);
       }
     }
 
@@ -105,14 +105,14 @@
     //! @Params
     //! @Param{source,source of the conversion}
     //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
- //! @Throws Whatever the underlying conversion @c To operator of the @c From class or the copy constructor of the @c To class throws.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
+ //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class or the copy constructor of the @c Target class throws.
     //!
     //! This function can be overloaded by the user.
     //! A trick is used to overload on the return type by adding a defaulted dummy parameter.
     //! Specializations must overload on @c dummy::type_tag<Target>
     //!
- //! This function doesn't participate on overload resolution when @c conversion::enable_functor<Source>::type.
+ //! This function doesn't participate on overload resolution when @c conversion::enable_functor<Source>::type is mpl::true_.
     template <typename Target, typename Source>
 #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
     typename disable_if<typename conversion::enable_functor<Source>::type, Target>::type

Modified: sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -12,10 +12,10 @@
  @brief
  Defines the free function @c convert_to_or_fallback.
 
- The @c convert_to_or_fallback function converts the @c from parameter to a @c To type. If the conversion fails the fallback value is used to construct a To @c instance.
+ The @c convert_to_or_fallback function converts the @c from parameter to a @c Target type. If the conversion fails the fallback value is used to construct a Target @c instance.
  
- The default implementation applies the conversion @c To operator of the @c From class or
- the copy constructor of the @c To class. When an exception is thrown the fallback is returned.
+ The default implementation applies the conversion @c Target operator of the @c Source class or
+ the copy constructor of the @c Target class. When an exception is thrown the fallback is returned.
  Of course if both exist the conversion is ambiguous.
  A user adapting another type could need to specialize the @c convert_to_or_fallback free function if the default behavior is not satisfactory.
 
@@ -38,21 +38,26 @@
 namespace boost {
   namespace conversion {
     //! This struct can be specialized by the user.
- template < typename To, typename From, typename Fallback>
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ template < typename Target, typename Source, typename Fallback, class Enable = void>
     struct converter_or_fallbacker {
       //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Requires @c Target must be CopyConstructible and @c ::boost::conversion::convert_to<Target>(from) must be well formed.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
       //! @Returns the converted value if the conversion succeeds or the fallback.
       //! @NoThrow
- To operator()(const From& val, Fallback const& fallback)
+ Target operator()(const Source& val, Fallback const& fallback)
       {
         try
         {
- return boost::conversion::convert_to<To>(val);
+ return boost::conversion::convert_to<Target>(val);
         }
         catch (...)
         {
- return To((fallback));
+ return Target((fallback));
         }
       }
     };
@@ -62,13 +67,13 @@
 
       //! @brief Default @c convert_to_or_fallback overload, used when ADL fails.
       //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
       //! @Returns the converted value if the conversion succeeds or the fallback.
       //! @NoThrow
       //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From, typename Fallback >
- To convert_to_or_fallback(const From& val, Fallback const& fallback, dummy::type_tag<To> const&) {
- return conversion::converter_or_fallbacker<To,From,Fallback>()(val, fallback);
+ template < typename Target, typename Source, typename Fallback >
+ Target convert_to_or_fallback(const Source& val, Fallback const& fallback, dummy::type_tag<Target> const&) {
+ return conversion::converter_or_fallbacker<Target,Source,Fallback>()(val, fallback);
       }
     }
 
@@ -82,8 +87,11 @@
     }
     #endif
 
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
     //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
     //! @Returns the converted value if the conversion succeeds or the fallback.
     //! @NoThrow
     //!

Modified: sandbox/conversion/boost/conversion/convert_to_via.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to_via.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to_via.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -16,9 +16,9 @@
 namespace boost {
   namespace conversion {
 
- template < typename To, typename Via, typename From >
- To convert_to_via(const From& val) {
- boost::conversion::convert_to<To>(boost::conversion::convert_to<Via>(val));
+ template < typename Target, typename Via, typename Source >
+ Target convert_to_via(const Source& val) {
+ boost::conversion::convert_to<Target>(boost::conversion::convert_to<Via>(val));
     }
 
   }

Modified: sandbox/conversion/boost/conversion/fp/convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/fp/convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/fp/convert_to.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -92,19 +92,19 @@
     //! boost::conversion::make_converter_to<int>(_1)(v);
     //! @endcode
     //! Creates a functor that when applied to the parameter v, converts it to an @c int.
- template <typename T, typename U>
+ template <typename Target, typename Source>
     inline
 #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- typename expression::convert_to<boost::phoenix::detail::target<T>, U>::type const
+ typename expression::convert_to<boost::phoenix::detail::target<Target>, Source>::type const
 #else
     unspecified_converter_type
 #endif
- make_converter_to(U const& u)
+ make_converter_to(Source const& u)
     {
       return
       expression::
- convert_to<boost::phoenix::detail::target<T>, U>::
- make(boost::phoenix::detail::target<T>(), u);
+ convert_to<boost::phoenix::detail::target<Target>, Source>::
+ make(boost::phoenix::detail::target<Target>(), u);
     }
 
     //! @brief Lazily convert to a type @c Target from an arbitrary argument.
@@ -118,18 +118,18 @@
     //! boost::conversion::convert_to<int>(_1)(v);
     //! @endcode
     //! Creates a functor that when applied to the parameter v, converts it to an @c int.
- template <typename T, typename U>
+ template <typename Target, typename Source>
     inline
 #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- typename enable_if<typename boost::conversion::enable_functor<U>::type,
- typename expression::convert_to<boost::phoenix::detail::target<T>, U>::type const
+ typename enable_if<typename boost::conversion::enable_functor<Source>::type,
+ typename expression::convert_to<boost::phoenix::detail::target<Target>, Source>::type const
>::type
 #else
     unspecified_converter_type
 #endif
- convert_to(U const& u)
+ convert_to(Source const& u)
     {
- return make_converter_to<T>(u);
+ return make_converter_to<Target>(u);
     }
   }
 }

Modified: sandbox/conversion/boost/conversion/std/complex.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/complex.hpp (original)
+++ sandbox/conversion/boost/conversion/std/complex.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2009-2011. 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)
 //
@@ -24,28 +24,29 @@
 namespace boost {
   namespace conversion {
 
- // std namespace can not be overloaded
- /**
- * Partial specialization of @c convert_to for @c std::complex of the same size
- */
- template < class T, class U>
- struct converter< std::complex<T>, std::complex<U> > {
- std::complex<T> operator()(std::complex<U> const & from)
- {
- return std::complex<T>(
- boost::conversion::convert_to<T>(from.real()),
- boost::conversion::convert_to<T>(from.imag()));
- }
- };
- template < class T, class U>
- struct assigner< std::complex<T>, std::complex<U> > {
- std::complex<T>& operator()(std::complex<T>& to, const std::complex<U>& from)
- {
- to.real() = boost::conversion::convert_to<T>(from.real());
- to.imag() = boost::conversion::convert_to<T>(from.imag());
- return to;
- }
- };
+ /**
+ * Partial specialization of @c convert_to for @c std::complex of the same size
+ */
+ template < class Target, class Source>
+ struct converter< std::complex<Target>, std::complex<Source> >
+ {
+ std::complex<Target> operator()(std::complex<Source> const & from)
+ {
+ return std::complex<Target>(
+ boost::conversion::convert_to<Target>(from.real()),
+ boost::conversion::convert_to<Target>(from.imag()));
+ }
+ };
+ template < class Target, class Source>
+ struct assigner< std::complex<Target>, std::complex<Source> >
+ {
+ std::complex<Target>& operator()(std::complex<Target>& to, const std::complex<Source>& from)
+ {
+ to.real() = boost::conversion::convert_to<Target>(from.real());
+ to.imag() = boost::conversion::convert_to<Target>(from.imag());
+ return to;
+ }
+ };
 
   }
 }

Modified: sandbox/conversion/boost/conversion/std/pair.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/pair.hpp (original)
+++ sandbox/conversion/boost/conversion/std/pair.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2009-2011. 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)
 //
@@ -25,24 +25,25 @@
   namespace conversion {
 
     // std namespace can not be overloaded
- template < class T1, class T2, class U1, class U2>
- struct converter< std::pair<T1,T2>, std::pair<U1,U2> > {
- std::pair<T1,T2> operator()(std::pair<U1,U2> const & from)
- {
- return std::pair<T1,T2>(boost::conversion::convert_to<T1>(from.first), boost::conversion::convert_to<T2>(from.second));
- }
- };
- template < class T1, class T2, class U1, class U2>
- struct assigner< std::pair<T1,T2>, std::pair<U1,U2> >
+ template < class T1, class T2, class S1, class S2>
+ struct converter< std::pair<T1,T2>, std::pair<S1,S2> >
+ {
+ std::pair<T1,T2> operator()(std::pair<S1,S2> const & from)
         {
- std::pair<T1,T2>& operator()(std::pair<T1,T2>& to, const std::pair<U1,U2>& from)
- {
- to.first = boost::conversion::convert_to<T1>(from.first);
- to.second = boost::conversion::convert_to<T2>(from.second);
- return to;
- }
- };
- }
+ return std::pair<T1,T2>(boost::conversion::convert_to<T1>(from.first), boost::conversion::convert_to<T2>(from.second));
+ }
+ };
+ template < class T1, class T2, class S1, class S2>
+ struct assigner< std::pair<T1,T2>, std::pair<S1,S2> >
+ {
+ std::pair<T1,T2>& operator()(std::pair<T1,T2>& to, const std::pair<S1,S2>& from)
+ {
+ to.first = boost::conversion::convert_to<T1>(from.first);
+ to.second = boost::conversion::convert_to<T2>(from.second);
+ return to;
+ }
+ };
+ }
 }
 
 #endif

Modified: sandbox/conversion/boost/conversion/std/string.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/string.hpp (original)
+++ sandbox/conversion/boost/conversion/std/string.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -30,47 +30,50 @@
 
     // std namespace can not be overloaded
       
- template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter< std::basic_string<CharT,Traits,Alloc>, T > {
- std::basic_string<CharT,Traits,Alloc> operator()(T const & from)
- {
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct converter< std::basic_string<CharT,Traits,Alloc>, T >
+ {
+ std::basic_string<CharT,Traits,Alloc> operator()(T const & from)
+ {
 #if !defined(BOOST_CONVERSION_USE_CONVERT)
- return lexical_cast<std::basic_string<CharT,Traits,Alloc> >(from);
+ return lexical_cast<std::basic_string<CharT,Traits,Alloc> >(from);
 #else
- return convert<std::basic_string<CharT,Traits,Alloc> >::from(from);
+ return convert<std::basic_string<CharT,Traits,Alloc> >::from(from);
 #endif
- }
- };
- template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter< T, std::basic_string<CharT,Traits,Alloc> > {
- T operator()(std::basic_string<CharT,Traits,Alloc> const & from)
- {
+ }
+ };
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct converter< T, std::basic_string<CharT,Traits,Alloc> >
+ {
+ T operator()(std::basic_string<CharT,Traits,Alloc> const & from)
+ {
 #if !defined(BOOST_CONVERSION_USE_CONVERT)
- return lexical_cast<T>(from);
+ return lexical_cast<T>(from);
 #else
- return convert<T>::from(from);
+ return convert<T>::from(from);
 #endif
- }
- };
-
- template<typename T, typename CharT, typename Traits, typename Alloc>
- struct assigner< std::basic_string<CharT,Traits,Alloc>, T > {
- std::basic_string<CharT,Traits,Alloc>&
- operator()(std::basic_string<CharT,Traits,Alloc>& to, const T& from)
- {
- to = boost::conversion::convert_to<std::basic_string<CharT,Traits,Alloc> >(from);
- return to;
- }
- };
- template<typename T, typename CharT, typename Traits, typename Alloc>
- struct assigner< T, std::basic_string<CharT,Traits,Alloc> > {
- T& operator()(T& to, const std::basic_string<CharT,Traits,Alloc>& from)
- {
- to = boost::conversion::convert_to<T>(from);
- return to;
- }
- };
+ }
+ };
 
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct assigner< std::basic_string<CharT,Traits,Alloc>, T >
+ {
+ std::basic_string<CharT,Traits,Alloc>&
+ operator()(std::basic_string<CharT,Traits,Alloc>& to, const T& from)
+ {
+ to = boost::conversion::convert_to<std::basic_string<CharT,Traits,Alloc> >(from);
+ return to;
+ }
+ };
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct assigner< T, std::basic_string<CharT,Traits,Alloc> >
+ {
+ T& operator()(T& to, const std::basic_string<CharT,Traits,Alloc>& from)
+ {
+ to = boost::conversion::convert_to<T>(from);
+ return to;
+ }
+ };
       
   }
 }

Modified: sandbox/conversion/boost/conversion/std/vector.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/vector.hpp (original)
+++ sandbox/conversion/boost/conversion/std/vector.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -28,52 +28,54 @@
   namespace conversion {
 
     // std namespace can not be overloaded
- template < class T1, class A1, class T2, class A2>
- struct converter< std::vector<T1,A1>, std::vector<T2,A2> > {
- std::vector<T1,A1> operator()(std::vector<T2,A2> const & from)
- {
- std::vector<T1,A1> res;
- boost::conversion::assign_to(res, from);
- return res;
- }
- };
+ template < class T1, class A1, class T2, class A2>
+ struct converter< std::vector<T1,A1>, std::vector<T2,A2> >
+ {
+ std::vector<T1,A1> operator()(std::vector<T2,A2> const & from)
+ {
+ std::vector<T1,A1> res;
+ boost::conversion::assign_to(res, from);
+ return res;
+ }
+ };
 
- template < class T1, class A1, class T2, class A2>
- struct converter< 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>
- >
+ template < class T1, class A1, class T2, class A2>
+ struct converter< 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>
>
+ >
+ {
+ std::vector<T1,A1> operator()(
+ typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
+ const & pack)
         {
- std::vector<T1,A1> operator()(
- 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).get());
- boost::conversion::assign_to(res, fusion::at_c<0>(pack).get());
- //std::vector<T1,A1> res(pack.second.get());
- //boost::conversion::assign_to(res, pack.first.get());
- return res;
- }
- };
+ std::vector<T1,A1> res(fusion::at_c<1>(pack).get());
+ boost::conversion::assign_to(res, fusion::at_c<0>(pack).get());
+ //std::vector<T1,A1> res(pack.second.get());
+ //boost::conversion::assign_to(res, pack.first.get());
+ return res;
+ }
+ };
 
- template < class T1, class A1, class T2, class A2>
- struct assigner< std::vector<T1,A1>, std::vector<T2,A2> > {
- std::vector<T1,A1>& operator()(
- std::vector<T1,A1>& to,
- std::vector<T2,A2> const & from)
- {
- to.resize(from.size());
- for (unsigned int i=0; i<from.size(); ++i) {
- boost::conversion::assign_to(to[i], from[i]);
- }
- return to;
+ template < class T1, class A1, class T2, class A2>
+ struct assigner< std::vector<T1,A1>, std::vector<T2,A2> >
+ {
+ std::vector<T1,A1>& operator()(
+ std::vector<T1,A1>& to,
+ std::vector<T2,A2> const & from)
+ {
+ to.resize(from.size());
+ for (unsigned int i=0; i<from.size(); ++i) {
+ boost::conversion::assign_to(to[i], from[i]);
             }
- };
- }
+ return to;
+ }
+ };
+ }
 }
 
 #endif

Modified: sandbox/conversion/boost/conversion/try_assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_assign_to.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -13,7 +13,7 @@
  Defines the free function @c try_assign_to.
 
 The function @c try_assign_to assigns the @c from parameter to the @c to parameter. Return @c true if assignation done and @c false otherwise.
-The default implementation applies the the assignment operator of the @c To class.
+The default implementation applies the the assignment operator of the @c Target class.
 A user adapting another type could need to specialize the @c try_assign_to free function if the default behavior is not satisfactory ot if it can improve the performances
 
 The user can add the @c try_assign_to overloading on the namespace of the Source or Target classes.
@@ -37,19 +37,24 @@
 
 namespace boost {
   namespace conversion {
+ //! Customization point for @try_assign_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
     //! This struct can be specialized by the user.
- template < typename To, typename From >
+ template < typename Target, typename Source, class Enable = void >
     struct try_assigner
     {
+ //! @Requires @c Target must be CopyConstructible and @c ::boost::conversion::assign_to(to, from) must be well formed.
       //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
       //! @NoThrow
       //! @Returns the converted value if success or the fallback when conversion fails.
- bool operator()(To& to, const From& from)
+ bool operator()(Target& to, const Source& from)
       {
- To rollback = to;
+ Target rollback = to;
         try
         {
- boost::conversion::assign_to<To>(to , from);
+ boost::conversion::assign_to<Target>(to , from);
           return true;
         }
         catch (...)
@@ -59,27 +64,27 @@
         }
       }
     };
- template < typename To, typename From, std::size_t N >
- struct try_assigner<To[N],From[N]>
+ template < typename Target, typename Source, std::size_t N >
+ struct try_assigner<Target[N],Source[N]>
     {
       //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator on each vector element.
       //! @NoThrow
       //! @Returns the converted value if success or the fallback when conversion fails.
- bool operator()(To(&to)[N], const From(& from)[N])
+ bool operator()(Target(&to)[N], const Source(& from)[N])
       {
- To rollback[N];
- boost::conversion::assign_to<To>(rollback, to);
+ Target rollback[N];
+ boost::conversion::assign_to<Target>(rollback, to);
         try
         {
           for (std::size_t i = 0; i < N; ++i)
           {
- boost::conversion::assign_to<To>(to[i] , from[i]);
+ boost::conversion::assign_to<Target>(to[i] , from[i]);
           }
           return true;
         }
         catch (...)
         {
- boost::conversion::assign_to<To>(to, rollback);
+ boost::conversion::assign_to<Target>(to, rollback);
           return false;
         }
       }
@@ -95,10 +100,10 @@
     //! @NoThrow
     //! @Returns the converted value if success or the fallback when conversion fails.
     //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- bool try_assign_to(To& to, const From& from)
+ template < typename Target, typename Source >
+ bool try_assign_to(Target& to, const Source& from)
     {
- return conversion::try_assigner<To,From>()(to, from);
+ return conversion::try_assigner<Target,Source>()(to, from);
     }
   }
 
@@ -114,18 +119,20 @@
 #endif
   namespace conversion {
 
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
- //! @NoThrow
- //! @Returns the converted value if success or the fallback when conversion fails.
- //!
- //! This function can be partially specialized on compilers supporting it.
- template <typename Target, typename Source>
- bool try_assign_to(Target& to, const Source& from)
- {
- return conversion_impl::try_assign_to_impl<Target, Source>(to, from);
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
+ //! @NoThrow
+ //! @Returns the converted value if success or the fallback when conversion fails.
+ //!
+ //! This function can be partially specialized on compilers supporting it.
+ template <typename Target, typename Source>
+ bool try_assign_to(Target& to, const Source& from)
+ {
+ return conversion_impl::try_assign_to_impl<Target, Source>(to, from);
+ }
   }
 }
-}
 
 #endif
 

Modified: sandbox/conversion/boost/conversion/try_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_convert_to.hpp 2011-06-02 10:26:34 EDT (Thu, 02 Jun 2011)
@@ -12,10 +12,10 @@
  @brief
  Defines the free function @c try_convert_to.
 
- The @c try_convert_to function converts the @c from parameter to a @c To type and returns an optional<To>, uninitialized if conversion fails.
+ The @c try_convert_to function converts the @c from parameter to a @c Target type and returns an optional<Target>, uninitialized if conversion fails.
  
- The default implementation applies the conversion @c To operator of the @c From class or
- the copy constructor of the @c To class on a try-catch block and returns optional with the converted value if succeeds and an uninitialized optional otherwise.
+ The default implementation applies the conversion @c Target operator of the @c Source class or
+ the copy constructor of the @c Target class on a try-catch block and returns optional with the converted value if succeeds and an uninitialized optional otherwise.
  Of course if both exist the conversion is ambiguous.
  A user adapting specific types could need to specialize the @c try_convert_to free function if the default behavior is not satisfactory or if the specialization can perform better.
 
@@ -38,21 +38,26 @@
 
 namespace boost {
   namespace conversion {
+ //! Customization point for @try_convert_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
     //! This struct can be specialized by the user.
- template < typename To, typename From >
+ template < typename Target, typename Source, class Enable = void >
     struct try_converter {
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Requires @c Target must be CopyConstructible and @c ::boost::conversion::convert_to<Target>(from) must be well formed.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
       //! @NoThrow
       //! @Returns A optional<Ratget> uninitialized when conversion fails.
- optional<To> operator()(const From& val)
+ optional<Target> operator()(const Source& val)
       {
         try
         {
- return make_optional(boost::conversion::convert_to<To>(val));
+ return make_optional(boost::conversion::convert_to<Target>(val));
         }
         catch (...)
         {
- return optional<To>();
+ return optional<Target>();
         }
       }
     };
@@ -63,13 +68,13 @@
 
       //! @brief Default @c try_convert_to overload, used when ADL fails.
       //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
       //! @NoThrow
       //! @Returns A optional<Target> uninitialized when conversion fails.
       //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- optional<To> try_convert_to(const From& val, dummy::type_tag<To> const&) {
- return conversion::try_converter<To,From>()(val);
+ template < typename Target, typename Source >
+ optional<Target> try_convert_to(const Source& val, dummy::type_tag<Target> const&) {
+ return conversion::try_converter<Target,Source>()(val);
       }
     }
     namespace impl {
@@ -83,17 +88,19 @@
 #endif
 
 
- //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
- //! @NoThrow
- //! @Returns A optional<Target> uninitialized when conversion fails.
- //!
- //! This function can be overloaded by the user for specific types.
- //! A trick is used to partially specialize on the return type by adding a dummy parameter.
- template <typename Target, typename Source>
- optional<Target> try_convert_to(Source const& from) {
- return boost::conversion::impl::try_convert_to_impl<Target>(from);
- }
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
+ //! @NoThrow
+ //! @Returns A optional<Target> uninitialized when conversion fails.
+ //!
+ //! This function can be overloaded by the user for specific types.
+ //! A trick is used to partially specialize on the return type by adding a dummy parameter.
+ template <typename Target, typename Source>
+ optional<Target> try_convert_to(Source const& from) {
+ return boost::conversion::impl::try_convert_to_impl<Target>(from);
+ }
   }
 
 }


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