|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72401 - in sandbox/conversion/boost/conversion: . boost std
From: vicente.botet_at_[hidden]
Date: 2011-06-05 04:30:31
Author: viboes
Date: 2011-06-05 04:30:28 EDT (Sun, 05 Jun 2011)
New Revision: 72401
URL: http://svn.boost.org/trac/boost/changeset/72401
Log:
Conversion: Continue adding enabling condition SFINAE
Text files modified:
sandbox/conversion/boost/conversion/assign_to.hpp | 7 ++++---
sandbox/conversion/boost/conversion/boost/array.hpp | 6 +++---
sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 16 ++++++++++++++--
sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 16 ++++++++++++++--
sandbox/conversion/boost/conversion/boost/interval.hpp | 4 ++--
sandbox/conversion/boost/conversion/boost/optional.hpp | 4 ++--
sandbox/conversion/boost/conversion/boost/rational.hpp | 4 ++--
sandbox/conversion/boost/conversion/boost/tuple.hpp | 21 +++++++++++++++++++--
sandbox/conversion/boost/conversion/convert_to.hpp | 10 ++++++++++
sandbox/conversion/boost/conversion/std/complex.hpp | 2 ++
sandbox/conversion/boost/conversion/std/pair.hpp | 4 ++--
sandbox/conversion/boost/conversion/std/string.hpp | 32 ++++++++++++++++++++++++++++----
sandbox/conversion/boost/conversion/std/vector.hpp | 19 ++++++++++++++-----
13 files changed, 116 insertions(+), 29 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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -46,10 +46,11 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
template < typename Target, typename Source>
- struct assigner_specialized
+ struct default_assigner_condition
: integral_constant<bool,
- is_copy_assignable<Target>::value
- && is_extrinsic_convertible<Source,Target>::value
+ is_assignable<Target,Source>::value
+ || ( is_copy_assignable<Target>::value
+ && is_extrinsic_convertible<Source,Target>::value)
>
{};
#endif
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -41,7 +41,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_assignable<array<Source,N>,array<Target,N> >::value
- && ! is_explicitly_convertible<array<Source,N>,array<Target,N> >::value
+ && ! default_converter_condition<array<Target,N>, array<Source,N> >::value
>::type
#endif
> : true_type
@@ -63,8 +63,8 @@
, typename enable_if_c<
is_copy_assignable<Target>::value
&& is_extrinsic_assignable<Source,Target>::value
- && ! is_assignable<Source&,Target const&>::value
- && ! assigner_specialized<array<Target,N>, array<Source,N> >::value
+ && ! is_assignable<Source,Target>::value
+ && ! default_assigner_condition<array<Target,N>, array<Source,N> >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -28,7 +28,13 @@
//! @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> > : true_type
+ struct converter<posix_time::time_duration, chrono::duration<Rep, Period>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition<posix_time::time_duration, chrono::duration<Rep, Period> >::value
+ >::type
+#endif
+ > : true_type
{
//! @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)
@@ -51,7 +57,13 @@
//!
template < class Rep, class Period>
- struct converter<chrono::duration<Rep, Period>, posix_time::time_duration> : true_type
+ struct converter<chrono::duration<Rep, Period>, posix_time::time_duration
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition<chrono::duration<Rep, Period>, posix_time::time_duration >::value
+ >::type
+#endif
+ > : true_type
{
//! @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)
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -28,7 +28,13 @@
namespace boost {
namespace conversion {
template < class Clock, class Duration>
- struct converter<posix_time::ptime, chrono::time_point<Clock, Duration> > : true_type
+ struct converter<posix_time::ptime, chrono::time_point<Clock, Duration>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition< posix_time::ptime, chrono::time_point<Clock, Duration> >::value
+ >::type
+#endif
+ > : true_type
{
posix_time::ptime operator()(const chrono::time_point<Clock, Duration>& from)
{
@@ -49,7 +55,13 @@
};
template < class Clock, class Duration>
- struct converter<chrono::time_point<Clock, Duration>, posix_time::ptime> : true_type
+ struct converter<chrono::time_point<Clock, Duration>, posix_time::ptime
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition< chrono::time_point<Clock, Duration>, posix_time::ptime >::value
+ >::type
+#endif
+ > : true_type
{
chrono::time_point<Clock, Duration> operator()(const posix_time::ptime& from)
{
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -30,7 +30,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
- && ! is_explicitly_convertible<numeric::interval<Source,PSource>,numeric::interval<Target,PTarget> >::value
+ && ! default_converter_condition< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >::value
>::type
#endif
> : true_type
@@ -46,7 +46,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
- && ! assigner_specialized<numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >::value
+ && ! default_assigner_condition<numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -49,7 +49,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
- && ! is_explicitly_convertible<optional<Source>,optional<Target> >::value
+ && ! default_converter_condition< optional<Target>, optional<Source> >::value
>::type
#endif
> : true_type
@@ -71,7 +71,7 @@
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
&& ! detail::is_optional<Source>::value
- && ! is_explicitly_convertible<Source,optional<Target> >::value
+ && ! default_converter_condition<optional<Target>, Source >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -33,7 +33,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
- && ! is_explicitly_convertible<rational<Source>,rational<Target> >::value
+ && ! default_converter_condition< rational<Target>, rational<Source> >::value
>::type
#endif
> : true_type
@@ -49,7 +49,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
- && ! assigner_specialized<rational<Target>, rational<Source> >::value
+ && ! default_assigner_condition<rational<Target>, rational<Source> >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -24,7 +24,15 @@
namespace boost {
namespace conversion {
template < class T1, class T2, class S1, class S2>
- struct converter< fusion::tuple<T1,T2>, fusion::tuple<S1,S2> > : true_type
+ struct converter< fusion::tuple<T1,T2>, fusion::tuple<S1,S2>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ && ! default_converter_condition< fusion::tuple<T1,T2>, fusion::tuple<S1,S2> >::value
+ >::type
+#endif
+ > : true_type
{
fusion::tuple<T1,T2> operator()(fusion::tuple<S1,S2> const & from)
{
@@ -35,7 +43,16 @@
}
};
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> > : true_type
+ struct converter< fusion::tuple<T1,T2,T3>, fusion::tuple<S1,S2,S3>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ && is_extrinsic_convertible<S3,T3>::value
+ && ! default_converter_condition< fusion::tuple<T1,T2,T3>, fusion::tuple<S1,S2,S3> >::value
+ >::type
+#endif
+ > : true_type
{
fusion::tuple<T1,T2,T3> operator()(fusion::tuple<S1,S2,S3> const & from)
{
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -75,6 +75,16 @@
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
#if defined(BOOST_CONVERSION_ENABLE_CND)
+
+ template < typename Target, typename Source>
+ struct default_converter_condition
+ : integral_constant<bool,
+ is_explicitly_convertible<Source,Target>::value
+ >
+ {};
+#endif
+
+#if defined(BOOST_CONVERSION_ENABLE_CND)
template < typename Target, typename Source, class Enable = void >
struct converter : false_type {};
template < typename Target, typename Source >
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -32,6 +32,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
+ && ! default_converter_condition< std::complex<Target>, std::complex<Source> >::value
>::type
#endif
> : true_type
@@ -48,6 +49,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
+ && ! default_assigner_condition< std::complex<Target>, std::complex<Source> >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -30,7 +30,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<S1,T1>::value && is_extrinsic_convertible<S2,T2>::value
- && ! is_explicitly_convertible<std::pair<S1,S2>,std::pair<T1,T2> >::value
+ && ! default_converter_condition< std::pair<T1,T2>, std::pair<S1,S2> >::value
>::type
#endif
> : true_type
@@ -45,7 +45,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_convertible<S1,T1>::value && is_extrinsic_convertible<S2,T2>::value
- && ! assigner_specialized<std::pair<T1,T2>,std::pair<S1,S2> >::value
+ && ! default_assigner_condition<std::pair<T1,T2>,std::pair<S1,S2> >::value
>::type
#endif
> : true_type
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -31,7 +31,13 @@
// std namespace can not be overloaded
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter< std::basic_string<CharT,Traits,Alloc>, T > : true_type
+ struct converter< std::basic_string<CharT,Traits,Alloc>, T
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition< std::basic_string<CharT,Traits,Alloc>, T >::value
+ >::type
+#endif
+ > : true_type
{
std::basic_string<CharT,Traits,Alloc> operator()(T const & from)
{
@@ -43,7 +49,13 @@
}
};
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter< T, std::basic_string<CharT,Traits,Alloc> > : true_type
+ struct converter< T, std::basic_string<CharT,Traits,Alloc>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_converter_condition< T, std::basic_string<CharT,Traits,Alloc> >::value
+ >::type
+#endif
+ > : true_type
{
T operator()(std::basic_string<CharT,Traits,Alloc> const & from)
{
@@ -56,7 +68,13 @@
};
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct assigner< std::basic_string<CharT,Traits,Alloc>, T > : true_type
+ struct assigner< std::basic_string<CharT,Traits,Alloc>, T
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_assigner_condition< std::basic_string<CharT,Traits,Alloc>, T >::value
+ >::type
+#endif
+ > : true_type
{
std::basic_string<CharT,Traits,Alloc>&
operator()(std::basic_string<CharT,Traits,Alloc>& to, const T& from)
@@ -66,7 +84,13 @@
}
};
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct assigner< T, std::basic_string<CharT,Traits,Alloc> > : true_type
+ struct assigner< T, std::basic_string<CharT,Traits,Alloc>
+#if defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ ! default_assigner_condition< T, std::basic_string<CharT,Traits,Alloc> >::value
+ >::type
+#endif
+ > : true_type
{
T& operator()(T& to, const std::basic_string<CharT,Traits,Alloc>& from)
{
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-05 04:30:28 EDT (Sun, 05 Jun 2011)
@@ -32,7 +32,8 @@
struct converter< std::vector<T1,A1>, std::vector<T2,A2>
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
- is_extrinsic_assignable<std::vector<T2,A2>,std::vector<T1,A1> >::value
+ is_extrinsic_assignable< std::vector<T2,A2>,std::vector<T1,A1> >::value
+ && ! default_converter_condition< std::vector<T2,A2>,std::vector<T1,A1> >::value
>::type
#endif
> : true_type
@@ -55,10 +56,17 @@
>
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
- is_extrinsic_assignable<std::pair<
- boost::reference_wrapper<std::vector<T2,A2> const>,
- boost::reference_wrapper<A1 const>
->, std::vector<T1,A1> >::value
+ is_extrinsic_assignable<std::pair<
+ boost::reference_wrapper<std::vector<T2,A2> const>,
+ boost::reference_wrapper<A1 const>
+ >, std::vector<T1,A1> >::value
+
+ && ! default_converter_condition< std::vector<T1,A1>,
+ std::pair<
+ boost::reference_wrapper<std::vector<T2,A2> const>,
+ boost::reference_wrapper<A1 const>
+ > >::value
+
>::type
#endif
> : false_type
@@ -80,6 +88,7 @@
#if defined(BOOST_CONVERSION_ENABLE_CND)
, typename enable_if_c<
is_extrinsic_assignable<T2,T1>::value
+ && ! default_assigner_condition< std::vector<T1,A1>, std::vector<T2,A2> >::value
>::type
#endif
> : true_type
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