|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73398 - in sandbox/conversion/boost/conversion: . boost type_traits type_traits/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2011-07-27 07:46:06
Author: viboes
Date: 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
New Revision: 73398
URL: http://svn.boost.org/trac/boost/changeset/73398
Log:
conversion: a lot of changes going on for a concept based library allowing overloading of the provided functions.
Added:
sandbox/conversion/boost/conversion/is_extrinsically_assignable_tagged.hpp (contents, props changed)
sandbox/conversion/boost/conversion/is_extrinsically_convertible_tagged.hpp (contents, props changed)
sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible_tagged.hpp (contents, props changed)
Text files modified:
sandbox/conversion/boost/conversion/assign_to.hpp | 33 +++-
sandbox/conversion/boost/conversion/boost/array.hpp | 16 --
sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 92 +++++----------
sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 78 ++++--------
sandbox/conversion/boost/conversion/boost/interval.hpp | 12 --
sandbox/conversion/boost/conversion/boost/optional.hpp | 16 --
sandbox/conversion/boost/conversion/boost/rational.hpp | 12 --
sandbox/conversion/boost/conversion/boost/tuple.hpp | 27 ----
sandbox/conversion/boost/conversion/config.hpp | 2
sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 12 --
sandbox/conversion/boost/conversion/explicit_convert_to.hpp | 114 +++++++++----------
sandbox/conversion/boost/conversion/implicit_convert_to.hpp | 100 +++++++++--------
sandbox/conversion/boost/conversion/is_extrinsically_convertible.hpp | 226 ++++++++++++++++++++++++++++++++++-----
sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible.hpp | 225 ++++++++++++++++++++++++++++++++++----
sandbox/conversion/boost/conversion/try_assign_to.hpp | 10 -
sandbox/conversion/boost/conversion/try_convert_to.hpp | 9 -
sandbox/conversion/boost/conversion/type_traits/boost/chrono/time_point.hpp | 4
sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp | 2
18 files changed, 585 insertions(+), 405 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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -18,7 +18,6 @@
*/
#ifndef BOOST_CONVERSION_ASSIGN_TO_HPP
#define BOOST_CONVERSION_ASSIGN_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
/**
A user adapting another type could need to specialize the @c assign_to free function if the default behavior is not satisfactory.
The user can add the @c assign_to overloading on the namespace of the Source or Target classes.
@@ -27,7 +26,6 @@
the @c boost::conversion::overload_workaround namespace.
*/
-#endif
#include <boost/conversion/config.hpp>
@@ -198,7 +196,6 @@
}
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion_impl_2 {
@@ -208,15 +205,30 @@
//! @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 Target, typename Source >
- Target& assign_to(Target& to, const Source& from)
+ typename enable_if_c<
+ conversion::assigner<Target,Source>::value
+ , Target&>::type
+ assign_to(Target& to, const Source& from)
{
return conversion::assigner<Target,Source>()(to, from);
}
}
+#endif
+
+
+}
+
+#include <boost/conversion/is_extrinsically_assignable_tagged.hpp>
+namespace boost {
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion_impl {
template <typename Target, typename Source>
- Target& assign_to_impl(Target& to, const Source& from)
+ Target&
+ //typename enable_if_c<
+ // is_extrinsically_assignable_tagged<Source,Target>::value
+ //, Target&>::type
+ assign_to_impl(Target& to, const Source& from)
{
using namespace boost::conversion_impl_2;
//use boost::conversion_impl_2::assign_to if ADL fails
@@ -224,7 +236,6 @@
}
}
#endif
-#endif
namespace conversion {
//! @brief Extrinsic assign function.
@@ -248,13 +259,13 @@
template <typename Target, typename Source>
- Target& assign_to(Target& to, const Source& from)
+ Target&
+ //typename enable_if_c<
+ // is_extrinsically_assignable_tagged<Source,Target>::value
+ //, Target&>::type
+ assign_to(Target& to, const Source& from)
{
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
return boost::conversion_impl::assign_to_impl<Target, Source>(to, from);
-#else
- return conversion::assigner<Target,Source>()(to, from);
-#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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -40,7 +40,7 @@
/**
* Partial specialization of @c implicit_converter for @c boost::array of the same size
*
- * !!!!!!!!!!!! boost::array is not constructible frome array<U,N> so this should be removed or replaced by explicit
+ * !!!!!!!!!!!! boost::array is not constructible from array<U,N> so this should be removed or replaced by explicit
*/
template < typename Target, typename Source, std::size_t N>
struct implicit_converter_cp< array<Target,N>, array<Source,N>
@@ -125,20 +125,6 @@
}
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- //! @brief @c assign_to overloading for source and target been @c boost::array of the same size.
- //!
- //! @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 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<Target,N>, array<Source,N> >()(to, from);
- }
-#endif
-#endif
}
#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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -18,8 +18,10 @@
#ifndef BOOST_CONVERSION_CHRONO_DURATION_TO_POSIX_TIME_DURATION_HPP
#define BOOST_CONVERSION_CHRONO_DURATION_TO_POSIX_TIME_DURATION_HPP
-#include <boost/chrono/duration.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/conversion/type_traits/boost/chrono/duration.hpp>
+//#include <boost/chrono/duration.hpp>
+#include <boost/conversion/type_traits/boost/date_time/posix_time/posix_time_types.hpp>
+//#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
#include <boost/config.hpp>
@@ -29,32 +31,32 @@
//! trick to generate the doc. Don't take care of it
struct trick_chrono_duration{};
#endif
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
- template <> struct is_constructible< posix_time::time_duration > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
- template <> struct is_constructible< posix_time::time_duration, posix_time::time_duration const& > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
- template <> struct is_assignable< posix_time::time_duration&, posix_time::time_duration const& > : true_type {};
- template <> struct is_assignable< posix_time::time_duration, posix_time::time_duration > : true_type {};
-#endif
-
-
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
- template < class Rep, class Period >
- struct is_constructible< chrono::duration<Rep, Period> > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
- template < class Rep, class Period >
- struct is_constructible< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
- template < class Rep, class Period >
- struct is_assignable< chrono::duration<Rep, Period>&, chrono::duration<Rep, Period> const& > : true_type {};
- template < class Rep, class Period >
- struct is_assignable< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
-#endif
+//#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+// template <> struct is_constructible< posix_time::time_duration > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+// template <> struct is_constructible< posix_time::time_duration, posix_time::time_duration const& > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+// template <> struct is_assignable< posix_time::time_duration&, posix_time::time_duration const& > : true_type {};
+// template <> struct is_assignable< posix_time::time_duration, posix_time::time_duration > : true_type {};
+//#endif
+
+
+//#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+// template < class Rep, class Period >
+// struct is_constructible< chrono::duration<Rep, Period> > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+// template < class Rep, class Period >
+// struct is_constructible< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+// template < class Rep, class Period >
+// struct is_assignable< chrono::duration<Rep, Period>&, chrono::duration<Rep, Period> const& > : true_type {};
+// template < class Rep, class Period >
+// struct is_assignable< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
+//#endif
namespace conversion {
@@ -96,40 +98,6 @@
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- namespace chrono {
-
- //! @brief @c assign_to overloading for conversions from @c boost::chrono::duration<> to @c boost::posix_time::time_duration.
- //!
- //! @Effects As if <c>to = boost::conversion::convert_to<duration<Rep, Period>>(from)</c>.
- //! @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)
- {
- to = boost::conversion::convert_to<duration<Rep, Period> >(from);
- return to;
- }
- }
-
- namespace posix_time {
-
- //! @brief @c assign_to overloading for conversions from @c boost::posix_time::time_duration to @c boost::chrono::duration<>.
- //!
- //! @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)
- {
- to = boost::conversion::convert_to<time_duration>(from);
- return to;
- }
- }
-
-#endif
-#endif
}
#endif
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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -19,9 +19,9 @@
#ifndef BOOST_CONVERSION_CHRONO_TIME_POINT_TO_POSIX_TIME_PTIME_HPP
#define BOOST_CONVERSION_CHRONO_TIME_POINT_TO_POSIX_TIME_PTIME_HPP
-#include <boost/chrono/time_point.hpp>
+#include <boost/conversion/type_traits/boost/chrono/time_point.hpp>
#include <boost/chrono/chrono.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/conversion/type_traits/boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/conversion.hpp>
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
@@ -32,32 +32,32 @@
//! trick to generate the doc. Don't take care of it
struct trick_chrono_time_point{};
#endif
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
- template <> struct is_constructible< boost::posix_time::ptime > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
- template <> struct is_constructible< boost::posix_time::ptime, boost::posix_time::ptime const& > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
- template <> struct is_assignable< boost::posix_time::ptime&, boost::posix_time::ptime const& > : true_type {};
- template <> struct is_assignable< boost::posix_time::ptime, boost::posix_time::ptime > : true_type {};
-#endif
-
-
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
- template < class Clock, class Duration>
- struct is_constructible< chrono::time_point<Clock, Duration> > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
- template < class Clock, class Duration>
- struct is_constructible< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
-#endif
-#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
- template < class Clock, class Duration>
- struct is_assignable< chrono::time_point<Clock, Duration>&, chrono::time_point<Clock, Duration> const& > : true_type {};
- template < class Clock, class Duration>
- struct is_assignable< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
-#endif
+//#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+// template <> struct is_constructible< boost::posix_time::ptime > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+// template <> struct is_constructible< boost::posix_time::ptime, boost::posix_time::ptime const& > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+// template <> struct is_assignable< boost::posix_time::ptime&, boost::posix_time::ptime const& > : true_type {};
+// template <> struct is_assignable< boost::posix_time::ptime, boost::posix_time::ptime > : true_type {};
+//#endif
+//
+//
+//#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+// template < class Clock, class Duration>
+// struct is_constructible< chrono::time_point<Clock, Duration> > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+// template < class Clock, class Duration>
+// struct is_constructible< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
+//#endif
+//#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+// template < class Clock, class Duration>
+// struct is_assignable< chrono::time_point<Clock, Duration>&, chrono::time_point<Clock, Duration> const& > : true_type {};
+// template < class Clock, class Duration>
+// struct is_assignable< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
+//#endif
namespace conversion {
@@ -96,28 +96,6 @@
}
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#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 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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -70,18 +70,6 @@
}
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- 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
-#endif
}
#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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -133,22 +133,6 @@
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- //! @brief @c assign_to overloading for source and target been @c boost::optional.
- //!
- //! @Effects As if <c>to = boost::conversion::implicit_convert_to<optional<Target> >(from)</c>.
- //! @Returns The @c to parameter reference.
- template < class Target, class Source>
- inline optional<Target>& assign_to(optional<Target>& to, const optional<Source>& from)
- {
- to = boost::conversion::implicit_convert_to<optional<Target> >(from);
- return to;
- }
-#endif
-#endif
-
}
#endif
Modified: sandbox/conversion/boost/conversion/boost/rational.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/rational.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/rational.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -25,7 +25,6 @@
#include <boost/mpl/bool.hpp>
#include <boost/utility/enable_if.hpp>
-
namespace boost {
#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
@@ -76,17 +75,6 @@
}
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- 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
-#endif
-
}
#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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -80,33 +80,6 @@
};
}
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP2)
-#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- 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
- );
-#else
-
- 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;
- }
-
- 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;
- }
- }
-#endif
-#endif
-#endif
}
#endif
Modified: sandbox/conversion/boost/conversion/config.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/config.hpp (original)
+++ sandbox/conversion/boost/conversion/config.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -18,6 +18,8 @@
#include <boost/config.hpp>
#include <boost/utility/enable_if.hpp>
+//#define BOOST_CONVERSION_USES_SFINAE
+
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
#if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
#else
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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -20,7 +20,6 @@
#ifndef BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
#define BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
/**
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.
@@ -35,7 +34,6 @@
* we can not add new functions on the @c std namespace, so we need a different technique.
* In this case the user can partially specialize the @c boost::conversion::overload_workaround::convert_to_or_fallback struct.
*/
-#endif
#include <boost/conversion/config.hpp>
#include <boost/conversion/convert_to.hpp>
@@ -104,7 +102,6 @@
};
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -129,7 +126,6 @@
}
}
#endif
-#endif
//! @brief Extrinsic conversion function with fallback.
//! 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.
@@ -150,11 +146,7 @@
! is_same<Target,Fallback>::value
, Target>::type
convert_to_or_fallback(Source const& from, Fallback const& fallback) {
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
return conversion::impl::convert_to_or_fallback_impl<Target>(from, fallback);
-#else
- return conversion::converter_or_fallbacker<Target,Source,Fallback>()(from, fallback);
-#endif
}
//! @brief Extrinsic conversion function with fallback.
//! 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.
@@ -170,11 +162,7 @@
//! @endcode
template <typename Target, typename Source>
Target convert_to_or_fallback(Source const& from, Target const& fallback) {
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
return conversion::impl::convert_to_or_fallback_impl<Target>(from, fallback);
-#else
- return conversion::converter_or_fallbacker<Target,Source>()(from, fallback);
-#endif
}
}
}
Modified: sandbox/conversion/boost/conversion/explicit_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/explicit_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/explicit_convert_to.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -16,7 +16,6 @@
*/
#ifndef BOOST_CONVERSION_EXPLICIT_CONVERT_TO_HPP
#define BOOST_CONVERSION_EXPLICIT_CONVERT_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
/**
* A user adapting another type could need to overload the @c explicit_convert_to free function
* if the default behavior is not satisfactory.
@@ -28,7 +27,6 @@
* In this case the user can partially specialize the @c boost::conversion::overload_workaround::explicit_convert_to struct.
*
*/
-#endif
#include <boost/conversion/implicit_convert_to.hpp>
@@ -43,11 +41,6 @@
namespace boost {
namespace conversion {
- template <typename Target, typename Source>
- Target
- explicit_convert_to(Source const& from);
-
-
//! Customization point for @c explicit_convert_to.
//!
//! @tparam Target target type of the conversion.
@@ -121,44 +114,7 @@
}
};
- //! @brief @c explicit converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
- //!
- //! @tparam Target target type of the conversion.
- //! @tparam Source source type of the conversion.
- //!
- //! @Requires @c is_extrinsically_explicit_convertible<Source,Target>
- //! We can see this specialization as a try_convert_to function.
- template < class Target, class Source>
- struct explicit_converter< optional<Target>, Source,
-#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- requires(ExtrinsicallyExplicitConvertible<Source,Target>)
-#else
- typename enable_if_c<
- explicit_converter<Target,Source>::value
- && ! detail::is_optional<Source>::value
- >::type
-#endif
- > : true_type
-
- {
- //! @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 optional<Target>(explicit_convert_to<Target>(from));
- }
- catch (...)
- {
- return optional<Target>();
- }
- }
- };
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -168,24 +124,25 @@
//! @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 Target, typename Source >
- Target explicit_convert_to(const Source& from, dummy::type_tag<Target> const&)
+ typename enable_if_c<
+ conversion::explicit_converter<Target,Source>::value
+ , Target>::type
+ explicit_convert_to(const Source& from, dummy::type_tag<Target> const&)
{
return conversion::explicit_converter<Target,Source>()(from);
}
}
- namespace impl {
- template <typename Target, typename Source>
- Target explicit_convert_to_impl(Source const& from)
- {
- using namespace boost::conversion::impl_2;
- //use boost::conversion::impl_2::explicit_convert_to if ADL fails
- return explicit_convert_to(from, dummy::type_tag<Target>());
- }
- }
-#endif
#endif
+ }
+}
+
+#include <boost/conversion/is_extrinsically_explicit_convertible_tagged.hpp>
+
+namespace boost {
+ namespace conversion {
+
//! @brief Extrinsic conversion function.
//! Converts the @c from parameter to an instance of the @c Target type.
//! This function can be seen as an emulation of free function overload of the conversion operator.
@@ -205,18 +162,51 @@
//! t=boost::conversion::explicit_convert_to<Target>(s);
//! @endcode
template <typename Target, typename Source>
- Target
+ typename enable_if_c<
+ is_extrinsically_explicit_convertible_tagged<Source,Target>::value
+ , Target>::type
explicit_convert_to(Source const& from)
{
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
- return boost::conversion::impl::explicit_convert_to_impl<Target>(from);
-#else
- return conversion::explicit_converter<Target,Source>()(from);
-#endif
+ using namespace boost::conversion::impl_2;
+ //use boost::conversion::impl_2::explicit_convert_to if ADL fails
+ return explicit_convert_to(from, dummy::type_tag<Target>());
}
+ //! @brief @c explicit converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
+ //!
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
+ //! @Requires @c is_extrinsically_explicit_convertible<Source,Target>
+ //! We can see this specialization as a try_convert_to function.
+ template < class Target, class Source>
+ struct explicit_converter< optional<Target>, Source,
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ requires(ExtrinsicallyExplicitConvertible<Source,Target>)
+#else
+ typename enable_if_c<
+ explicit_converter<Target,Source>::value
+ && ! detail::is_optional<Source>::value
+ >::type
+#endif
+ > : true_type
-
+ {
+ //! @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 optional<Target>(explicit_convert_to<Target>(from));
+ }
+ catch (...)
+ {
+ return optional<Target>();
+ }
+ }
+ };
}
}
Modified: sandbox/conversion/boost/conversion/implicit_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/implicit_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/implicit_convert_to.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -10,27 +10,30 @@
/**
* @file
- * @brief Defines the free function @c implicit_convert_to and its customization point @c implicit_converter.
+ * @brief Defines the free function @c implicit_convert_to and its customization
+ * point @c implicit_converter.
*
- * The @c implicit_convert_to function converts the @c from parameter to a @c Target type.
+ * The @c implicit_convert_to function converts the @c from parameter to a
+ * @c Target type and is intended to be used in a implicit context.
+ *
+ * The default behavior call the implicit conversion when @c Source is
+ * implicitly convertible to @c Target
+ *
+ * When the default behavior is not satisfactory or it doesn't takes care of
+ * specific types, the user could customize the behavior of
+ * @c implicit_convert_to in two ways:
+ *
+ * * overload the @c implicit_convert_to on any namespace found by ADL from the
+ * @c Source or the @c Target. A trick is used to overload on the return type
+ * by adding a dummy parameter depending on the @c Target.
+ * * partially specialize the @c boost::conversion::implicit_converter_cp struct.
+ *
+ * @note As we can not add new functions on the @c std namespace, partial
+ * specialization is the only option.
*
*/
#ifndef BOOST_CONVERSION_IMPLICIT_CONVERT_TO_HPP
#define BOOST_CONVERSION_IMPLICIT_CONVERT_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
-/**
- * A user adapting another type could need to overload the @c implicit_convert_to free function
- * if the default behavior is not satisfactory.
- * The user can add the @c implicit_convert_to overloading on any namespace found by ADL from the @c Source or the @c Target.
- * A trick is used to overload on the return type by adding a dummy parameter having the Target.
- *
- * But sometimes, as it is the case for the standard classes,
- * we can not add new functions on the @c std namespace, so we need a different technique.
- * In this case the user can partially specialize the @c boost::conversion::overload_workaround::implicit_convert_to struct.
- *
- */
-#endif
-
#include <boost/conversion/config.hpp>
#include <boost/type_traits/integral_constant.hpp>
@@ -40,9 +43,8 @@
namespace boost {
namespace conversion {
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
namespace dummy {
- //! tag used to overload a function returning T.
+ //! tag used to overload a function returning the parameter @c T.
//!
//! @tparam T The wrapped return type.
//! Users overloading the @c implicit_convert_to function must use this tag.
@@ -53,16 +55,15 @@
typedef T type;
};
}
-#endif
-
- //! Customization point for @c implicit_convert_to.
+ //! Customization point for @c implicit_convert_to free function.
//!
//! @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 class must be specialized by the user when the default behavior of @c implicit_converter is not satisfying.
+ //! This class can be specialized by the user when the default behavior of
+ //! @c implicit_converter doesn't takes care of he specific types.
template < typename Target, typename Source, class Enable = void >
struct implicit_converter_cp : false_type {};
@@ -72,12 +73,14 @@
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
//!
- //! The default implementation relies on the @c implicit_converter_cp which must be specialized by the user.
+ //! The default implementation relies on the @c implicit_converter_cp which
+ //! must be specialized by the user.
template < typename Target, typename Source, class Enable = void >
struct implicit_converter : implicit_converter_cp<Target,Source,Enable> {};
- //! Specialization for @c implicit_converter when @c is_convertible<Source,Target>.
+ //! Specialization for @c implicit_converter when
+ //! @c is_convertible<Source,Target>.
//!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
@@ -92,15 +95,17 @@
#endif
> : true_type
{
- //! @Effects Converts the @c from parameter to an instance of the @c Target type, using the conversion operator or copy constructor.
- //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class throws.
+ /**
+ * @Effects Converts the @c from parameter to an instance of the
+ * @c Target type, using the conversion operator or copy constructor.
+ * @Throws Whatever the underlying conversion @c Target operator of the @c Source class throws.
+ */
Target operator()(typename add_reference<const Source>::type val)
{
return val;
}
};
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -110,24 +115,25 @@
//! @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 Target, typename Source >
- Target implicit_convert_to(const Source& from, dummy::type_tag<Target> const&)
+ typename enable_if_c<
+ conversion::implicit_converter<Target,Source>::value
+ , Target>::type
+ implicit_convert_to(const Source& from, dummy::type_tag<Target> const&)
{
return conversion::implicit_converter<Target,Source>()(from);
}
}
- namespace impl {
- template <typename Target, typename Source>
- Target implicit_convert_to_impl(Source const& from)
- {
- using namespace boost::conversion::impl_2;
- //use boost::conversion::impl_2::implicit_convert_to if ADL fails
- return implicit_convert_to(from, dummy::type_tag<Target>());
- }
- }
-#endif
#endif
+ } // namespace conversion
+} // namespace boost
+
+#include <boost/conversion/is_extrinsically_convertible_tagged.hpp>
+
+namespace boost {
+ namespace conversion {
+
//! @brief Extrinsic conversion function.
//! Converts the @c from parameter to an instance of the @c Target type.
//! This function can be seen as an emulation of free function overload of the conversion operator.
@@ -147,17 +153,17 @@
//! t=boost::conversion::implicit_convert_to<Target>(s);
//! @endcode
template <typename Target, typename Source>
- Target
+ typename enable_if_c<
+ is_extrinsically_convertible_tagged<Source, Target>::value
+ , Target>::type
implicit_convert_to(Source const& from)
{
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
- return boost::conversion::impl::implicit_convert_to_impl<Target>(from);
-#else
- return conversion::implicit_converter<Target,Source>()(from);
-#endif
+ using namespace boost::conversion::impl_2;
+ //use boost::conversion::impl_2::implicit_convert_to if ADL fails
+ return implicit_convert_to(from, dummy::type_tag<Target>());
}
- }
-}
+ } // namespace conversion
+} // namespace boost
-#endif
+#endif // header
Added: sandbox/conversion/boost/conversion/is_extrinsically_assignable_tagged.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/is_extrinsically_assignable_tagged.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -0,0 +1,235 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/conversion for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief Defines the type trait @c is_extrinsically_assignable_tagged.
+ */
+
+#ifndef BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_HPP
+#define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_HPP
+
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+ namespace conversion {
+ /**
+ * States if @c Source is extrinsically assignable to @c Target.
+ *
+ * Condition: @c true_type if and only if the return expression in the following code
+ * would be well-formed:
+ * @code
+ * Target test() { return implicit_convert_to<Target>(declval<Source>()); }
+ * @endcode
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ *
+ */
+ template <class Source, class Target>
+ struct is_extrinsically_assignable_tagged {};
+
+ //! Macro stating if the compiler doesn't support the features needed to define the @c is_extrinsically_assignable type trait for classes.
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+
+ }
+}
+#else
+
+
+#include <boost/conversion/config.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/common_type.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_function.hpp>
+
+#include <boost/utility/declval.hpp>
+#include <boost/conversion/assign_to.hpp>
+
+
+#if ! defined BOOST_NO_DECLTYPE
+ #if defined _MSC_VER
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+ #endif
+ #elif defined __clang__
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_DECLTYPE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+ #endif
+ #else
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_DECLTYPE
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+ #endif
+ #else
+#error
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_DECLTYPE
+ //#define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+ #endif
+#elif ! defined BOOST_NO_SFINAE_EXPR
+ #if defined _MSC_VER
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+#elif defined __clang__
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ #elif defined __GNUC__
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+ #else
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+ #endif
+#else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_ASSIGNABLE_TAGGED
+#endif
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ #if defined _MSC_VER
+ #elif defined __clang__
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_RVALUE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_RVALUE
+ #endif
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_RVALUE
+ #endif
+#endif
+
+namespace boost {
+ namespace conversion {
+ namespace detail_is_extrinsically_assignable_tagged {
+ using namespace boost::conversion_impl_2;
+ struct any {
+ template <typename T>
+ any(T);
+ };
+ //! type useful to compare with the sizeof
+ typedef char yes_type;
+ //! type useful to compare with the sizeof
+ struct no_type { char a[2]; };
+
+ //! type useful to accept a sizeof as parameter
+ template<std::size_t N>
+ struct dummy;
+
+ template <class S, class T,
+ bool True =
+ (is_void<S>::value && is_void<T>::value)
+ || ((is_scalar<T>::value || is_reference<T>::value) && is_assignable<S,T>::value)
+ ,
+ bool False =
+ (is_void<S>::value && !is_void<T>::value)
+ || (!is_void<S>::value && is_void<T>::value)
+ || is_abstract<T>::value
+ || is_function<T>::value >
+ struct imp;
+
+#if defined BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_DECLTYPE
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template <class S1, class T1>
+ static decltype((
+ assign_to(declval<S1>(), declval<T1>()) // EXPR
+ , true_type()))
+ #if defined BOOST_CONVERSION_TT_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_RVALUE
+ selector(S1&&, T1&&);
+ #else
+ selector(S1&, T1&);
+ #endif
+
+ template <class S1, class T1>
+ static false_type
+ selector(any,any);
+
+ typedef typename common_type<decltype(selector(declval<S>(), declval<T>()))>::type type;
+ };
+
+#elif defined BOOST_CONVERSION_IS_EXTRINSIC_ASSIGNABLE_TAGGED_USES_SIZEOF
+
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template<class X, class Y>
+ static detail_is_extrinsically_assignable_tagged::yes_type
+ selector(detail_is_extrinsically_assignable_tagged::dummy<
+ sizeof(
+ assign_to(declval<S1>(), declval<T1>()) // EXPR
+ )
+ >*);
+
+ template<class X, class Y>
+ static detail_is_extrinsically_assignable_tagged::no_type
+ selector(...);
+
+ static const bool value =
+ sizeof(selector<S,T>(0)) ==
+ sizeof(detail_is_extrinsically_assignable_tagged::yes_type);
+ typedef boost::integral_constant<bool,value> type;
+ };
+
+#else
+ template <class S,class T>
+ struct imp<S,T,false,false>
+ : public conversion::assigner<T,S> {};
+#endif
+// template <class S, class T, std::size_t N>
+// struct imp<S[N],T[N],false,false>
+// : public false_type {};
+// template <class S, class T, std::size_t N>
+// struct imp<S[N],T,false,false>
+// : public false_type {};
+// template <class S, class T, std::size_t N>
+// struct imp<S,T[N],false,false>
+// : public false_type {};
+// template <class S, class T>
+// struct imp<S[],T[],false,false>
+// : public false_type {};
+// template <class S, class T>
+// struct imp<S[],T,false,false>
+// : public false_type {};
+// template <class S, class T>
+// struct imp<S,T[],false,false>
+// : public false_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, true,B>
+ : public true_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, B,true>
+ : public false_type {};
+
+ } // detail
+
+
+ template <class Source, class Target>
+ struct is_extrinsically_assignable_tagged
+ : public detail_is_extrinsically_assignable_tagged::imp<Source, Target> {};
+
+} // conversion
+} // boost
+
+#endif // doc
+
+#endif // header
+
Modified: sandbox/conversion/boost/conversion/is_extrinsically_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/is_extrinsically_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/is_extrinsically_convertible.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -15,48 +15,214 @@
#ifndef BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_HPP
#define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_HPP
-#include <boost/conversion/implicit_convert_to.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/remove_cv.hpp>
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+ namespace conversion {
+ /**
+ * States if @c Source is extrinsically explicit convertible to @c Target.
+ *
+ * Condition: @c true_type if and only if the return expression in the following code
+ * would be well-formed:
+ * @code
+ * Target test() { return implicit_convert_to<Target>(declval<Source>()); }
+ * @endcode
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ *
+ */
+ template <class Source, class Target>
+ struct is_extrinsically_convertible {};
+
+ //! Macro stating if the compiler doesn't support the features needed to define the @c is_extrinsically_convertible type trait for classes.
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE
+
+ }
+}
+#else
+
+#include <boost/conversion/config.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/common_type.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/utility/declval.hpp>
#include <boost/fusion/tuple.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
+#include <boost/conversion/type_traits/is_convertible.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
+
+#if ! defined BOOST_CONVERSION_USES_SFINAE
+//#if 0
+#define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE
+#else
+#if ! defined BOOST_NO_DECLTYPE
+ #if defined _MSC_VER
+ #if ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE
+ #endif
+ #elif defined __clang__
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_DECLTYPE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #if ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE
+ #endif
+ #else
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_DECLTYPE
+ #endif
+ #else
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_DECLTYPE
+ #endif
+#elif ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_SIZEOF
+ #if defined __clang__
+ #elif defined __GNUC__
+ #endif
+#else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE
+#endif
+#endif
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ #if defined _MSC_VER
+ #elif defined __clang__
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_USES_RVALUE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_USES_RVALUE
+ #endif
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_USES_RVALUE
+ #endif
+#endif
namespace boost {
namespace conversion {
- /**
- * States if @c Source is extrinsically convertible to @c Target.
- *
- * Condition: @c true_type if and only if the return expression in the following code
- * would be well-formed:
- * @code
- * Target test() { return implicit_convert_to<Target>(declval<Source>()); }
- * @endcode
- *
- * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
- *
- */
+ namespace detail_is_extrinsically_convertible {
+ struct any {
+ template <typename T>
+ any(T);
+ };
+ //! type useful to compare with the sizeof
+ typedef char yes_type;
+ //! type useful to compare with the sizeof
+ struct no_type { char a[2]; };
+
+ //! type useful to accept a sizeof as parameter
+ template<std::size_t N>
+ struct dummy;
+
+ template <class S, class T,
+ bool True =
+ (is_void<S>::value && is_void<T>::value)
+ || ((is_scalar<T>::value || is_reference<T>::value) && is_convertible<S,T>::value)
+ ,
+ bool False =
+ (is_void<S>::value && !is_void<T>::value)
+ || (!is_void<S>::value && is_void<T>::value)
+ || is_abstract<T>::value
+ || is_function<T>::value
+ >
+ struct imp;
+
+#if defined BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_DECLTYPE
+#error
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template <class S1, class T1>
+ static decltype((
+ ::boost::conversion::implicit_convert_to<T1>(declval<S1>()) // EXPR
+ , true_type()))
+ #if defined BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_RVALUE
+ selector(S1&&, T1&&);
+ #else
+ selector(S1&, T1&);
+ #endif
+
+ template <class S1, class T1>
+ static false_type
+ selector(any,any);
+
+ typedef typename common_type<decltype(selector(declval<S>(), declval<T>()))>::type type;
+ };
+#elif defined BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_USES_SIZEOF
+#error
+
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template<class X, class Y>
+ static detail_is_extrinsically_convertible::yes_type
+ selector(detail_is_extrinsically_convertible::dummy<
+ sizeof(
+ ::boost::conversion::implicit_convert_to<T1>(declval<S1>()) // EXPR
+ )
+ >*);
+
+ template<class X, class Y>
+ static detail_is_extrinsically_convertible::no_type
+ selector(...);
+
+ static const bool value =
+ sizeof(selector<S,T>(0)) ==
+ sizeof(detail_is_extrinsically_convertible::yes_type);
+ typedef boost::integral_constant<bool,value> type;
+ };
+
+#else
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ : public is_extrinsically_convertible_tagged<S,T> {};
+#endif
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T[N],false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T,false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S,T[N],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T[],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T,false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S,T[],false,false>
+ : public false_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, true,B>
+ : public true_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, B,true>
+ : public false_type {};
+ }
+
template <class Source, class Target>
- struct is_extrinsically_convertible : conversion::implicit_converter<
- Target, Source
- //typename remove_reference<typename remove_cv<Target>::type>::type,
- //typename remove_reference<typename remove_cv<Source>::type>::type
- > {};
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ struct is_extrinsically_convertible
+ : public detail_is_extrinsically_convertible::imp<Source, Target> {};
+
template <class T>
struct is_extrinsically_convertible<fusion::void_,T> : false_type {};
- template <>
- struct is_extrinsically_convertible<void, void> : true_type {};
- template <>
- struct is_extrinsically_convertible<const void,void> : true_type {};
- template <>
- struct is_extrinsically_convertible<void, const void> : true_type {};
- template <>
- struct is_extrinsically_convertible<const void, const void> : true_type {};
-#endif
}
}
#endif
+#endif
Added: sandbox/conversion/boost/conversion/is_extrinsically_convertible_tagged.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/is_extrinsically_convertible_tagged.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -0,0 +1,236 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/conversion for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief Defines the type trait @c is_extrinsically_convertible_tagged.
+ */
+
+#ifndef BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_HPP
+#define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_HPP
+
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+ namespace conversion {
+ /**
+ * States if @c Source is extrinsically explicit convertible to @c Target.
+ *
+ * Condition: @c true_type if and only if the return expression in the following code
+ * would be well-formed:
+ * @code
+ * Target test() { return implicit_convert_to<Target>(declval<Source>()); }
+ * @endcode
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ *
+ */
+ template <class Source, class Target>
+ struct is_extrinsically_convertible_tagged {};
+
+ //! Macro stating if the compiler doesn't support the features needed to define the @c is_extrinsically_convertible type trait for classes.
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+
+ }
+}
+#else
+
+
+#include <boost/conversion/config.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/common_type.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_function.hpp>
+
+#include <boost/utility/declval.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
+
+
+#if ! defined BOOST_NO_DECLTYPE
+ #if defined _MSC_VER
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+ #endif
+ #elif defined __clang__
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+ #endif
+ #else
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+ #endif
+ #else
+#error
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ //#define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+ #endif
+#elif ! defined BOOST_NO_SFINAE_EXPR
+ #if defined _MSC_VER
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+#elif defined __clang__
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #elif defined __GNUC__
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+ #else
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #endif
+#else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_CONVERTIBLE_TAGGED
+#endif
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ #if defined _MSC_VER
+ #elif defined __clang__
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_RVALUE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_RVALUE
+ #endif
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_RVALUE
+ #endif
+#endif
+
+namespace boost {
+ namespace conversion {
+ //namespace impl_2 {}
+ namespace detail_is_extrinsically_convertible_tagged {
+ using namespace boost::conversion::impl_2;
+ struct any {
+ template <typename T>
+ any(T);
+ };
+ //! type useful to compare with the sizeof
+ typedef char yes_type;
+ //! type useful to compare with the sizeof
+ struct no_type { char a[2]; };
+
+ //! type useful to accept a sizeof as parameter
+ template<std::size_t N>
+ struct dummy;
+
+ template <class S, class T,
+ bool True =
+ (is_void<S>::value && is_void<T>::value)
+ || ((is_scalar<T>::value || is_reference<T>::value) && is_convertible<S,T>::value)
+ ,
+ bool False =
+ (is_void<S>::value && !is_void<T>::value)
+ || (!is_void<S>::value && is_void<T>::value)
+ || is_abstract<T>::value
+ || is_function<T>::value >
+ struct imp;
+
+#if defined BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template <class S1, class T1>
+ static decltype((
+ implicit_convert_to(declval<S1>(), conversion::dummy::type_tag<T1>()) // EXPR
+ , true_type()))
+ #if defined BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_RVALUE
+ selector(S1&&, T1&&);
+ #else
+ selector(S1&, T1&);
+ #endif
+
+ template <class S1, class T1>
+ static false_type
+ selector(any,any);
+
+ typedef typename common_type<decltype(selector(declval<S>(), declval<T>()))>::type type;
+ };
+
+#elif defined BOOST_CONVERSION_IS_EXTRINSIC_CONVERTIBLE_TAGGED_USES_SIZEOF
+
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template<class X, class Y>
+ static detail_is_extrinsically_convertible_tagged::yes_type
+ selector(detail_is_extrinsically_convertible_tagged::dummy<
+ sizeof(
+ implicit_convert_to(declval<X>(), conversion::dummy::type_tag<Y>()) // EXPR
+ )
+ >*);
+
+ template<class X, class Y>
+ static detail_is_extrinsically_convertible_tagged::no_type
+ selector(...);
+
+ static const bool value =
+ sizeof(selector<S,T>(0)) ==
+ sizeof(detail_is_extrinsically_convertible_tagged::yes_type);
+ typedef boost::integral_constant<bool,value> type;
+ };
+
+#else
+ template <class S,class T>
+ struct imp<S,T,false,false>
+ : public conversion::implicit_converter<T,S> {};
+#endif
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T[N],false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T,false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S,T[N],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T[],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T,false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S,T[],false,false>
+ : public false_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, true,B>
+ : public true_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, B,true>
+ : public false_type {};
+
+ } // detail
+
+
+ template <class Source, class Target>
+ struct is_extrinsically_convertible_tagged
+ : public detail_is_extrinsically_convertible_tagged::imp<Source, Target> {};
+
+} // conversion
+} // boost
+
+#endif // doc
+
+#endif // header
+
Modified: sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -15,42 +15,211 @@
#ifndef BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_HPP
#define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_HPP
-#include <boost/conversion/explicit_convert_to.hpp>
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+ namespace conversion {
+ /**
+ * States if @c Source is extrinsically explicit convertible to @c Target.
+ *
+ * Condition: @c true_type if and only if the return expression in the following code
+ * would be well-formed:
+ * @code
+ * Target test() { return explicit_convert_to<Target>(declval<Source>()); }
+ * @endcode
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ *
+ */
+ template <class Source, class Target>
+ struct is_extrinsically_explicit_convertible {};
+
+ //! Macro stating if the compiler doesn't support the features needed to define the @c is_extrinsically_explicit_convertible type trait for classes.
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE
+
+ }
+}
+#else
+
+
+#include <boost/conversion/config.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/common_type.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/utility/declval.hpp>
#include <boost/fusion/tuple.hpp>
+#include <boost/conversion/explicit_convert_to.hpp>
+#include <boost/conversion/type_traits/is_convertible.hpp>
+
+#if ! defined BOOST_CONVERSION_USES_SFINAE
+#define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE
+#else
+#if ! defined BOOST_NO_DECLTYPE
+ #if defined _MSC_VER
+ #if ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE
+ #endif
+ #elif defined __clang__
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_DECLTYPE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #if ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE
+ #endif
+ #else
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_DECLTYPE
+ #endif
+ #else
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_DECLTYPE
+ #endif
+#elif ! defined BOOST_NO_SFINAE_EXPR
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_SIZEOF
+ #if defined __clang__
+ #elif defined __GNUC__
+ #endif
+#else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE
+#endif
+#endif
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ #if defined _MSC_VER
+ #elif defined __clang__
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_RVALUE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_RVALUE
+ #endif
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_RVALUE
+ #endif
+#endif
namespace boost {
namespace conversion {
+ namespace detail_is_extrinsically_explicit_convertible {
+ struct any {
+ template <typename T>
+ any(T);
+ };
+ //! type useful to compare with the sizeof
+ typedef char yes_type;
+ //! type useful to compare with the sizeof
+ struct no_type { char a[2]; };
+
+ //! type useful to accept a sizeof as parameter
+ template<std::size_t N>
+ struct dummy;
+
+ template <class S, class T,
+ bool True =
+ ((
+ (is_void<S>::value && is_void<T>::value)
+ || ((is_scalar<T>::value || is_reference<T>::value) && is_convertible<S,T>::value)
+ ))
+ ,
+ bool False =
+ ((
+ (is_void<S>::value && !is_void<T>::value)
+ || (!is_void<S>::value && is_void<T>::value)
+ || is_abstract<T>::value
+ || is_function<T>::value
+ ))
+ >
+ struct imp;
+#if defined BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_DECLTYPE
+#error
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template <class S1, class T1>
+ static decltype((
+ ::boost::conversion::explicit_convert_to<T1>(declval<S1>()) // EXPR
+ , true_type()))
+ #if defined BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_RVALUE
+ selector(S1&&, T1&&);
+ #else
+ selector(S1&, T1&);
+ #endif
+
+ template <class S1, class T1>
+ static false_type
+ selector(any,any);
+
+ typedef typename common_type<decltype(selector(declval<S>(), declval<T>()))>::type type;
+ };
+#elif defined BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_USES_SIZEOF
+#error
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template<class X, class Y>
+ static detail_is_extrinsically_explicit_convertible::yes_type
+ selector(detail_is_extrinsically_explicit_convertible::dummy<
+ sizeof(
+ ::boost::conversion::explicit_convert_to<T1>(declval<S1>()) // EXPR
+ )
+ >*);
+
+ template<class X, class Y>
+ static detail_is_extrinsically_explicit_convertible::no_type
+ selector(...);
+
+ static const bool value =
+ sizeof(selector<S,T>(0)) ==
+ sizeof(detail_is_extrinsically_explicit_convertible::yes_type);
+ typedef boost::integral_constant<bool,value> type;
+ };
+#else
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ : public is_extrinsically_explicit_convertible_tagged<S,T> {};
+#endif
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T[N],false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T,false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S,T[N],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T[],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T,false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S,T[],false,false>
+ : public false_type {};
+
+ template <class S,class T, bool B>
+ struct imp<S, T, true,B>
+ : public true_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, B,true>
+ : public false_type {};
+ }
- /**
- * States if @c Source is extrinsically explicit convertible to @c Target.
- *
- * Condition: @c true_type if and only if the return expression in the following code
- * would be well-formed:
- * @code
- * Target test() { return explicit_convert_to<Target>(declval<Source>()); }
- * @endcode
- *
- * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
- *
- */
template <class Source, class Target>
- struct is_extrinsically_explicit_convertible : conversion::explicit_converter<Target, Source> {};
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ struct is_extrinsically_explicit_convertible
+ : public detail_is_extrinsically_explicit_convertible::imp<Source, Target> {};
+
template <class T>
struct is_extrinsically_explicit_convertible<fusion::void_,T> : false_type {};
- template <>
- struct is_extrinsically_explicit_convertible<void, void> : true_type {};
- template <>
- struct is_extrinsically_explicit_convertible<const void,void> : true_type {};
- template <>
- struct is_extrinsically_explicit_convertible<void, const void> : true_type {};
- template <>
- struct is_extrinsically_explicit_convertible<const void, const void> : true_type {};
-#endif
-
- }
+}
}
-
-#endif
+#endif // doc
+#endif // header
Added: sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible_tagged.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/is_extrinsically_explicit_convertible_tagged.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -0,0 +1,231 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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)
+//
+// See http://www.boost.org/libs/conversion for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+/**
+ * @file
+ * @brief Defines the type trait @c is_extrinsically_explicit_convertible.
+ */
+
+#ifndef BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_HPP
+#define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_HPP
+
+
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+ namespace conversion {
+ /**
+ * States if @c Source is extrinsically explicit convertible to @c Target.
+ *
+ * Condition: @c true_type if and only if the return expression in the following code
+ * would be well-formed:
+ * @code
+ * Target test() { return explicit_convert_to<Target>(declval<Source>()); }
+ * @endcode
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ *
+ */
+ template <class Source, class Target>
+ struct is_extrinsically_explicit_convertible_tagged {};
+
+ //! Macro stating if the compiler doesn't support the features needed to define the @c is_extrinsically_explicit_convertible type trait for classes.
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+
+ }
+}
+#else
+
+
+#include <boost/conversion/config.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/common_type.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/utility/declval.hpp>
+#include <boost/conversion/explicit_convert_to.hpp>
+#include <boost/conversion/type_traits/is_convertible.hpp>
+
+#if ! defined BOOST_NO_DECLTYPE
+ #if defined _MSC_VER
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+ #endif
+ #elif defined __clang__
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #if ! defined BOOST_NO_SFINAE_EXPR
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+ #endif
+ #else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+ //#define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ #endif
+ #else
+#error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ #endif
+#elif ! defined BOOST_NO_SFINAE_EXPR
+ #if defined __clang__
+#error
+#define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #elif defined __GNUC__
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+ #else
+ #error
+ #define BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_SIZEOF
+ #endif
+#else
+ #define BOOST_CONVERSION_NO_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED
+#endif
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ #if defined _MSC_VER
+ #elif defined __clang__
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_RVALUE
+ #elif defined __GNUC__
+ #if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_RVALUE
+ #endif
+ #else
+ #define BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_RVALUE
+ #endif
+#endif
+
+namespace boost {
+ namespace conversion {
+ namespace impl_2 {}
+ namespace detail_is_extrinsically_explicit_convertible_tagged {
+ using namespace boost::conversion::impl_2;
+ struct any {
+ template <typename T>
+ any(T);
+ };
+ //! type useful to compare with the sizeof
+ typedef char yes_type;
+ //! type useful to compare with the sizeof
+ struct no_type { char a[2]; };
+
+ //! type useful to accept a sizeof as parameter
+ template<std::size_t N>
+ struct dummy;
+
+ template <class S, class T,
+ bool True =
+ (is_void<S>::value && is_void<T>::value)
+ || ((is_scalar<T>::value || is_reference<T>::value) && is_convertible<S,T>::value)
+ ,
+ bool False =
+ (is_void<S>::value && !is_void<T>::value)
+ || (!is_void<S>::value && is_void<T>::value)
+ || is_abstract<T>::value
+ || is_function<T>::value
+ >
+ struct imp;
+
+#if defined BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_DECLTYPE
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template <class S1, class T1>
+ static decltype((
+ explicit_convert_to(declval<S1>(), conversion::dummy::type_tag<T1>()) // EXPR
+ , true_type()))
+ #if defined BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_RVALUE
+ selector(S1&&, T1&&);
+ #else
+ selector(S1&, T1&);
+ #endif
+
+ template <class S1, class T1>
+ static false_type
+ selector(any,any);
+
+ typedef typename common_type<decltype(selector(declval<S>(), declval<T>()))>::type type;
+ };
+
+#elif defined BOOST_CONVERSION_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_TAGGED_USES_SIZEOF
+
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ {
+ template<class X, class Y>
+ static detail_is_extrinsically_explicit_convertible_tagged::yes_type
+ selector(detail_is_extrinsically_explicit_convertible_tagged::dummy<
+ sizeof(
+ explicit_convert_to(declval<X>(), conversion::dummy::type_tag<Y>()) // EXPR
+ )
+ >*);
+
+ template<class X, class Y>
+ static detail_is_extrinsically_explicit_convertible_tagged::no_type
+ selector(...);
+
+ static const bool value =
+ sizeof(selector<S,T>(0)) ==
+ sizeof(detail_is_extrinsically_explicit_convertible_tagged::yes_type);
+ typedef boost::integral_constant<bool,value> type;
+ };
+
+#else
+ template <class S, class T>
+ struct imp<S,T,false,false>
+ : public conversion::explicit_converter<T,S> {};
+#endif
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T[N],false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S[N],T,false,false>
+ : public false_type {};
+ template <class S, class T, std::size_t N>
+ struct imp<S,T[N],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T[],false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S[],T,false,false>
+ : public false_type {};
+ template <class S, class T>
+ struct imp<S,T[],false,false>
+ : public false_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, true,B>
+ : public true_type {};
+
+ template <class S,class T,bool B>
+ struct imp<S, T, B,true>
+ : public false_type {};
+
+ } // detail
+
+
+ template <class Source, class Target>
+ struct is_extrinsically_explicit_convertible_tagged
+ : public detail_is_extrinsically_explicit_convertible_tagged::imp<Source, Target> {};
+
+} // conversion
+} // boost
+
+#endif // doc
+
+#endif // header
+
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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -20,8 +20,6 @@
#ifndef BOOST_CONVERSION_TRY_ASSIGN_TO_HPP
#define BOOST_CONVERSION_TRY_ASSIGN_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
-
/**
The user can add the @c try_assign_to overloading on the namespace of the Source or Target classes.
But sometimes as it is the case for the standard classes, we can not add new functions on the std namespace,
@@ -33,7 +31,6 @@
on a class with the same name in the namespace @c overload_workaround.
Thus the user can specialize partially this class.
*/
-#endif
#include <cstddef> //for std::size_t
@@ -103,7 +100,6 @@
}
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion_impl_2 {
//! @brief Default @c try_assign_to overload, used when ADL fails.
@@ -129,7 +125,7 @@
}
}
#endif
-#endif
+
namespace conversion {
//! @brief try to assign a target from a source
@@ -148,11 +144,7 @@
template <typename Target, typename Source>
bool try_assign_to(Target& to, const Source& from)
{
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
return conversion_impl::try_assign_to_impl<Target, Source>(to, from);
-#else
- return conversion::try_assigner<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-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -20,7 +20,6 @@
#ifndef BOOST_CONVERSION_TRY_CONVERT_TO_HPP
#define BOOST_CONVERSION_TRY_CONVERT_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
/**
* 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.
@@ -33,8 +32,6 @@
* we can not add new functions on the @c std namespace, so we need a different technique.
* In this case the user can partially specialize the @c boost::conversion::overload_workaround::try_convert_to struct.
*/
-#endif
-
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/boost/optional.hpp>
@@ -67,7 +64,6 @@
}
};
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -91,7 +87,6 @@
}
}
#endif
-#endif
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
@@ -107,11 +102,7 @@
//! @endcode
template <typename Target, typename Source>
optional<Target> try_convert_to(Source const& from) {
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
return boost::conversion::impl::try_convert_to_impl<Target>(from);
-#else
- return conversion::try_converter<Target,Source>()(from);
-#endif
}
}
Modified: sandbox/conversion/boost/conversion/type_traits/boost/chrono/time_point.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/boost/chrono/time_point.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/boost/chrono/time_point.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -12,8 +12,8 @@
* @brief Type traits specializations for <boost/chrono/time_point.hpp> types.
*/
-#ifndef BOOST_CONVERSION_TT_BOOST_CHRONO_DURATION_HPP
-#define BOOST_CONVERSION_TT_BOOST_CHRONO_DURATION_HPP
+#ifndef BOOST_CONVERSION_TT_BOOST_CHRONO_TIME_POINT_HPP
+#define BOOST_CONVERSION_TT_BOOST_CHRONO_TIME_POINT_HPP
#include <boost/conversion/type_traits/is_assignable.hpp>
#include <boost/conversion/type_traits/is_constructible.hpp>
Modified: sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp 2011-07-27 07:46:00 EDT (Wed, 27 Jul 2011)
@@ -66,7 +66,7 @@
#include <boost/type_traits/is_abstract.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/type_traits/is_void.hpp>
-#include <boost/type_traits/is_convertible.hpp>
+#include <boost/conversion/type_traits/is_convertible.hpp>
#include <boost/type_traits/remove_all_extents.hpp>
#if ! defined BOOST_NO_DECLTYPE
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