|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72673 - in sandbox/conversion/boost/conversion: . boost detail std type_traits
From: vicente.botet_at_[hidden]
Date: 2011-06-19 03:41:34
Author: viboes
Date: 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
New Revision: 72673
URL: http://svn.boost.org/trac/boost/changeset/72673
Log:
Conversion: MAJOR change spliting implicit and explicit conversions
Added:
sandbox/conversion/boost/conversion/config.hpp (contents, props changed)
sandbox/conversion/boost/conversion/detail/
sandbox/conversion/boost/conversion/detail/is_optional.hpp (contents, props changed)
sandbox/conversion/boost/conversion/implicit_convert_to.hpp (contents, props changed)
Text files modified:
sandbox/conversion/boost/conversion/assign_to.hpp | 86 +++++++++++---------------
sandbox/conversion/boost/conversion/assignable_to.hpp | 5
sandbox/conversion/boost/conversion/boost/array.hpp | 36 +++++------
sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 17 ++---
sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 17 ++---
sandbox/conversion/boost/conversion/boost/interval.hpp | 31 +++++----
sandbox/conversion/boost/conversion/boost/optional.hpp | 75 ++++++++++++++---------
sandbox/conversion/boost/conversion/boost/rational.hpp | 25 ++++---
sandbox/conversion/boost/conversion/boost/tuple.hpp | 43 ++++++------
sandbox/conversion/boost/conversion/ca_wrapper.hpp | 1
sandbox/conversion/boost/conversion/convert_to.hpp | 124 -------------------------------------
sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 1
sandbox/conversion/boost/conversion/convertible_from.hpp | 9 +-
sandbox/conversion/boost/conversion/convertible_to.hpp | 9 +-
sandbox/conversion/boost/conversion/explicit_convert_to.hpp | 128 +++++++++++++++++++++++++++++----------
sandbox/conversion/boost/conversion/include.hpp | 3
sandbox/conversion/boost/conversion/std/complex.hpp | 20 ++---
sandbox/conversion/boost/conversion/std/pair.hpp | 27 +++----
sandbox/conversion/boost/conversion/std/string.hpp | 25 ------
sandbox/conversion/boost/conversion/std/vector.hpp | 34 +++-------
sandbox/conversion/boost/conversion/try_assign_to.hpp | 3
sandbox/conversion/boost/conversion/try_convert_to.hpp | 1
sandbox/conversion/boost/conversion/type_traits/is_assignable.hpp | 47 ++++++++++++--
sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp | 16 +++-
sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp | 3
sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp | 1
26 files changed, 364 insertions(+), 423 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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -7,6 +7,7 @@
// See http://www.boost.org/libs/conversion for documentation.
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
@@ -28,34 +29,20 @@
*/
#endif
+#include <boost/conversion/config.hpp>
#include <cstddef> //for std::size_t
#include <boost/conversion/convert_to.hpp>
#include <boost/utility/enable_if.hpp>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
#include <boost/conversion/type_traits/is_copy_assignable.hpp>
#include <boost/conversion/type_traits/is_assignable.hpp>
#include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
-#endif
+#include <boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp>
namespace boost {
namespace conversion {
-#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
-
- /**
- * States the default assigner condition used when no constraint is associated to the @c Target and @c Source parameters.
- */
- template < typename Target, typename Source>
- struct default_assigner_condition
- : integral_constant<bool,
- is_assignable<Target,Source>::value
- || ( is_copy_assignable<Target>::value
- && is_extrinsic_convertible<Source,Target>::value)
- >
- {};
-#endif
//! Customization point for @c assign_to.
//! @tparam Target target type of the conversion.
@@ -68,46 +55,34 @@
template < typename Target, typename Source, class Enable = void>
struct assigner : assigner_cp<Target,Source,Enable> {};
-
-
/**
* Specialization when @c Target is not assignable from @c Source, but @c Target is copy constructible and @c Source is extrinsic convertible to @c Target.
* @Requires @c Target must be CopyAssinable and @c @c Source must be extrinsic convertible to @c Target.
*/
template < typename Target, typename Source>
struct assigner<Target, Source
- , typename enable_if_c<
- is_copy_assignable<Target>::value
- && is_extrinsic_convertible<Source,Target>::value
- && ! is_assignable<Target,Source>::value
- >::type
- > : true_type
-#else
- template < typename Target, typename Source, class Enable = void>
- struct assigner_cp
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_copy_assignable<Target>::value
+ && is_extrinsic_explicit_convertible<Source,Target>::value
+ && ! is_assignable<Target,Source>::value
+ ))
+ > : true_type
{
//! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
//! @Throws Whatever the underlying assignment operator of the @c Target class throws.
Target& operator()(Target& to, const Source& from)
{
- to = ::boost::conversion::convert_to<Target>(from);
+ to = ::boost::conversion::explicit_convert_to<Target>(from);
return to;
}
};
-#if !defined(BOOST_CONVERSION_ENABLE_CND)
- template < typename Target, typename Source, class Enable = void >
- struct assigner : assigner_cp<Target,Source,Enable> {};
-#endif
-
-#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
/**
* Specialization when @c Target is assignable from @c Source.
* @Requires @c Target must be Assinable from Source.
*/
template < typename Target, typename Source>
struct assigner<Target,Source
- , typename enable_if<is_assignable<Target, Source> >::type
+ BOOST_CONVERSION_REQUIRES((is_assignable<Target, Source>::value))
> : true_type
{
//! @Effects Assigns the @c from parameter to the @c to parameter.
@@ -118,20 +93,33 @@
return to;
}
};
+
+#else
+ template < typename Target, typename Source, class Enable = void>
+ struct assigner_cp : true_type
+ {
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
+ //! @Throws Whatever the underlying assignment operator of the @c Target class throws.
+ Target& operator()(Target& to, const Source& from)
+ {
+ to = ::boost::conversion::implicit_convert_to<Target>(from);
+ return to;
+ }
+ };
+ template < typename Target, typename Source, class Enable = void>
+ struct assigner : assigner_cp<Target,Source,Enable> {};
#endif
//! partial specialization for c-array types.
//! @Requires @c Target must be CopyAssinable and @c @c Source must be extrinsic convertible to @c Target.
template < typename Target, typename Source, std::size_t N >
struct assigner<Target[N],Source[N]
-#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- , typename enable_if_c<
- is_copy_assignable<Target>::value
- && is_extrinsic_convertible<Source,Target>::value
- && ! is_assignable<Target,Source>::value
- >::type
-#endif
- > : true_type
+ BOOST_CONVERSION_REQUIRES((
+ is_copy_assignable<Target>::value
+ && is_extrinsic_convertible<Source,Target>::value
+ && ! is_assignable<Target,Source>::value
+ ))
+ > : true_type
{
//! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator on each one of the array elements.
//! @Throws Whatever the underlying assignment operator of the @c Target class throws.
@@ -140,7 +128,7 @@
{
for (std::size_t i = 0; i < N; ++i)
{
- to[i] = ::boost::conversion::convert_to<Target>(from[i]);
+ to[i] = ::boost::conversion::implicit_convert_to<Target>(from[i]);
}
return to;
}
@@ -151,10 +139,10 @@
//! @Requires @c Target must be Assinable from @c Source.
template < typename Target, typename Source, std::size_t N >
struct assigner<Target[N],Source[N]
- , typename enable_if_c<
- is_assignable<Target, Source>::value
- >::type
- > : true_type
+ BOOST_CONVERSION_REQUIRES((
+ is_assignable<Target, Source>::value
+ ))
+ > : true_type
{
//! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator on each one of the array elements.
//! @Throws Whatever the underlying assignment operator of the @c Target class throws.
Modified: sandbox/conversion/boost/conversion/assignable_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/assignable_to.hpp (original)
+++ sandbox/conversion/boost/conversion/assignable_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,10 +8,11 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
- Defines the free function @c mca.
+ Defines the free function @c mat.
*/
#ifndef BOOST_CONVERSION_ASSIGNABLE_TO_HPP
#define BOOST_CONVERSION_ASSIGNABLE_TO_HPP
@@ -101,7 +102,7 @@
return *this;
}
};
- //! makes an assignable to @c Target.
+ //! makes an assignable to @c Target which accepts assignment from any type that is extrinsic assignable to @c Target.
//! The result is able to transform conversion by convert_to calls and assignments by assign_to calls.
//! @NoThrow.
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -18,32 +18,32 @@
#define BOOST_CONVERSION_ARRAY_HPP
#include <boost/array.hpp>
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
#include <algorithm>
#include <boost/config.hpp>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
#include <boost/conversion/type_traits/is_extrinsic_assignable.hpp>
#include <boost/conversion/type_traits/is_copy_assignable.hpp>
#include <boost/conversion/type_traits/is_assignable.hpp>
#include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
#include <boost/conversion/type_traits/is_explicitly_convertible.hpp>
-#endif
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct converter_cp{};
+#endif
/**
* Partial specialization of @c 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
*/
template < typename Target, typename Source, std::size_t N>
struct converter_cp< array<Target,N>, array<Source,N>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_assignable<Target,Source>::value
- //&& ! default_converter_condition<array<Target,N>, array<Source,N> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((is_extrinsic_assignable<Target, Source>::value))
> : true_type
{
//! @Returns the array having as elements the result of the conversion of each one of the source array elements.
@@ -64,13 +64,10 @@
*/
template < typename Target, typename Source, std::size_t N>
struct assigner_cp< array<Target,N>, array<Source,N>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
+ BOOST_CONVERSION_REQUIRES((
is_extrinsic_assignable<Target,Source>::value
&& ! is_assignable<Target, Source>::value
- //&& ! default_assigner_condition<array<Target,N>, array<Source,N> >::value
- >::type
-#endif
+ ))
> : true_type
{
//! @Effects assign to each one of the target array elements the conversion of the source array element.
@@ -86,14 +83,13 @@
/**
* Partial specialization of @c assigner for @c boost::array of the same size
*/
-#if defined(BOOST_CONVERSION_ENABLE_CND)
+#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
template < typename Target, typename Source, std::size_t N>
struct assigner_cp< array<Target,N>, array<Source,N>
- , typename enable_if_c<
- is_extrinsic_assignable<Target,Source>::value
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_assignable<Target,Source>::value
&& is_assignable<Target, Source>::value
- //&& ! default_assigner_condition<array<Target,N>, array<Source,N> >::value
- >::type
+ ))
> : true_type
{
//! @Effects assign to each one of the target array elements the conversion of the source array element.
@@ -111,7 +107,7 @@
#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- //! @brief @c convert_to overloading for source and target been @c boost::array of the same size.
+ //! @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.
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,6 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
@@ -25,15 +26,16 @@
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct converter_cp{};
+#endif
+
//! @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_cp<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.
@@ -58,11 +60,6 @@
template < class Rep, class Period>
struct converter_cp<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.
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,6 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
@@ -27,13 +28,14 @@
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct converter_cp{};
+#endif
+
template < class Clock, class Duration>
struct converter_cp<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)
@@ -56,11 +58,6 @@
template < class Clock, class Duration>
struct converter_cp<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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -18,42 +18,43 @@
#define BOOST_CONVERSION_INTERVAL_HPP
#include <boost/numeric/interval.hpp>
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct implicit_converter_cp{};
+#endif
+
+
//! @brief @c converter specialization for source and target been @c boost::numeric::interval.
//!
template < class Target, class PTarget, class Source, class PSource>
struct converter_cp< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- //&& ! default_converter_condition< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
//! @Returns the target interval having as extremes the conversion from the source interval extremes.
numeric::interval<Target,PTarget> operator()(numeric::interval<Source,PSource> const & from)
{
- return numeric::interval<Target,PTarget>(boost::conversion::convert_to<Target>(from.lower()), boost::conversion::convert_to<Source>(from.upper()));
+ return numeric::interval<Target,PTarget>(boost::conversion::implicit_convert_to<Target>(from.lower()), boost::conversion::implicit_convert_to<Source>(from.upper()));
}
};
template < class Target, class PTarget, class Source, class PSource>
struct assigner_cp< numeric::interval<Target,PTarget>, numeric::interval<Source,PSource>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- //&& ! default_assigner_condition<numeric::interval<Target,PTarget>, numeric::interval<Source,PSource> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
numeric::interval<Target,PTarget>& operator()(numeric::interval<Target,PTarget>& to, const numeric::interval<Source,PSource>& from)
{
- to.assign(boost::conversion::convert_to<Target>(from.lower()), boost::conversion::convert_to<Source>(from.upper()));
+ to.assign(boost::conversion::implicit_convert_to<Target>(from.lower()), boost::conversion::implicit_convert_to<Source>(from.upper()));
return to;
}
};
Modified: sandbox/conversion/boost/conversion/boost/optional.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/optional.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/optional.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -22,58 +22,48 @@
#include <boost/none.hpp>
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
+#include <boost/conversion/detail/is_optional.hpp>
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
-
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion {
- namespace detail {
- template <typename T>
- struct is_optional : mpl::false_ {};
- template <typename T>
- struct is_optional< ::boost::optional<T> > : mpl::true_ {};
- }
- }
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable>
+ struct converter_cp{};
#endif
-
- namespace conversion {
/**
* Partial specialization of @c converter for boost::optional
*/
template < class Target, class Source>
- struct converter_cp< optional<Target>, optional<Source>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- //&& ! default_converter_condition< optional<Target>, optional<Source> >::value
- >::type
-#endif
+ struct converter_cp
+ < optional<Target>, optional<Source>
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
//! @Returns If the optional source is initialized @c boost::optional<Target> initialized to the conversion of the optional value.
//! Uninitialized @c boost::optional<Target otherwise.
optional<Target> operator()(optional<Source> const & from)
{
- return (from?optional<Target>(boost::conversion::convert_to<Target>(from.get())):optional<Target>());
+ return (from?optional<Target>(boost::conversion::implicit_convert_to<Target>(from.get())):optional<Target>());
}
};
+
//! @brief @c converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
//!
//! We can see this specialization as a try_convert_to function.
template < class Target, class Source>
struct converter_cp< optional<Target>, Source
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- && ! detail::is_optional<Source>::value
- //&& ! default_converter_condition<optional<Target>, Source >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ && ! detail::is_optional<Source>::value
+ ))
> : true_type
{
@@ -84,7 +74,7 @@
{
try
{
- return optional<Target>(boost::conversion::convert_to<Target>(from));
+ return optional<Target>(boost::conversion::implicit_convert_to<Target>(from));
}
catch (...)
{
@@ -93,6 +83,33 @@
}
};
+ //! @brief @c explicit converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
+ //!
+ //! We can see this specialization as a try_convert_to function.
+ template < class Target, class Source>
+ struct explicit_converter_cp< optional<Target>, Source
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_explicit_convertible<Source,Target>::value
+ && ! detail::is_optional<Source>::value
+ ))
+ > : 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>(boost::conversion::explicit_convert_to<Target>(from));
+ }
+ catch (...)
+ {
+ return optional<Target>();
+ }
+ }
+ };
}
@@ -100,12 +117,12 @@
#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::convert_to<optional<Target> >(from)</c>.
+ //! @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::convert_to<optional<Target> >(from);
+ to = boost::conversion::implicit_convert_to<optional<Target> >(from);
return to;
}
#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-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -14,6 +14,7 @@
Include this file when using conversions between @c boost::rational<> of convertible types.
*/
+
#ifndef BOOST_CONVERSION_PAIR__HPP
#define BOOST_CONVERSION_PAIR__HPP
@@ -26,16 +27,19 @@
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct converter_cp{};
+#endif
+
//! @brief @c converter specialization for source and target been @c boost::rational.
//!
template < class Target, class Source>
struct converter_cp< rational<Target>, rational<Source>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- //&& ! default_converter_condition< rational<Target>, rational<Source> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
//! @Returns the target rational having as numerator and denominator the conversion from the numerator and denominator of the source rational.
@@ -46,12 +50,9 @@
};
template < class Target, class Source>
struct assigner_cp< rational<Target>, rational<Source>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_convertible<Source,Target>::value
- //&& ! default_assigner_condition<rational<Target>, rational<Source> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
rational<Target>& operator()(rational<Target>& to, const rational<Source>& from)
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -17,41 +17,42 @@
#define BOOST_CONVERSION_TUPLE_HPP
#include <boost/fusion/tuple.hpp>
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/explicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
#include <boost/config.hpp>
+
namespace boost {
namespace conversion {
- template < class T1, class T2, class S1, class S2>
- struct converter_cp< 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
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
+ /** @brief Added here only to favor generation of specializations with doxygen */
+ template < class Target, class Source, class Enable=void>
+ struct explicit_converter_cp{};
#endif
- > : true_type
+
+ template < class T1, class T2, class S1, class S2>
+ struct explicit_converter_cp< fusion::tuple<T1,T2>, fusion::tuple<S1,S2>
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ ))
+ > : true_type
{
fusion::tuple<T1,T2> operator()(fusion::tuple<S1,S2> const & from)
{
return fusion::tuple<T1,T2>(
- boost::conversion::convert_to<T1>(fusion::get<0>(from))
- , boost::conversion::convert_to<T2>(fusion::get<1>(from))
+ boost::conversion::implicit_convert_to<T1>(fusion::get<0>(from))
+ , boost::conversion::implicit_convert_to<T2>(fusion::get<1>(from))
);
}
};
template < class T1, class T2, class T3, class S1, class S2, class S3>
- struct converter_cp< 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
+ struct explicit_converter_cp< fusion::tuple<T1,T2,T3>, fusion::tuple<S1,S2,S3>
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ && is_extrinsic_convertible<S3,T3>::value
+ ))
> : true_type
{
fusion::tuple<T1,T2,T3> operator()(fusion::tuple<S1,S2,S3> const & from)
Modified: sandbox/conversion/boost/conversion/ca_wrapper.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/ca_wrapper.hpp (original)
+++ sandbox/conversion/boost/conversion/ca_wrapper.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,6 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
Added: sandbox/conversion/boost/conversion/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/config.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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
+ *
+ */
+#ifndef BOOST_CONVERSION_CONFIG_HPP
+#define BOOST_CONVERSION_CONFIG_HPP
+
+#include <boost/config.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#define BOOST_CONVERSION_REQUIRES(CND) \
+ , typename enable_if_c< CND >::type
+
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+#define BOOST_CONVERSION_ENABLE_CND
+#else
+ #if ! defined(BOOST_NO_DECLTYPE)
+ #if ! defined _MSC_VER
+ #define BOOST_CONVERSION_ENABLE_CND
+ #endif
+ #endif
+#endif
+
+
+#endif
+
Modified: sandbox/conversion/boost/conversion/convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -7,6 +7,7 @@
// See http://www.boost.org/libs/conversion for documentation.
//
//////////////////////////////////////////////////////////////////////////////
+
/**
* @file
* @brief Defines the free function @c convert_to and its customization point @c converter.
@@ -16,54 +17,13 @@
*/
#ifndef BOOST_CONVERSION_CONVERT_TO_HPP
#define BOOST_CONVERSION_CONVERT_TO_HPP
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
-/**
- * A user adapting another type could need to overload the @c convert_to free function
- * if the default behavior is not satisfactory.
- * The user can add the @c 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::convert_to struct.
- *
- */
-#endif
-
-#include <boost/config.hpp>
-#if ! defined(BOOST_NO_DECLTYPE)
-#if ! defined _MSC_VER
-#define BOOST_CONVERSION_ENABLE_CND
-#endif
-#endif
-#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
-#define BOOST_CONVERSION_ENABLE_CND
-#endif
+#include <boost/conversion/explicit_convert_to.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/integral_constant.hpp>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
-#include <boost/conversion/type_traits/is_convertible.hpp>
-#endif
namespace boost {
namespace conversion {
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
- namespace dummy {
- //! tag used to overload a function returning T.
- //!
- //! @tparam T The wrapped return type.
- //! Users overloading the @c convert_to function must use this tag.
- template <typename T>
- struct type_tag
- {
- //! The nested type @c type names the template parameter.
- typedef T type;
- };
- }
-#endif
//! meta-function to state if the parameter is a place_holder
//!
//! @tparam T The type to check for.
@@ -75,80 +35,6 @@
struct enable_functor : false_type {};
-#if defined(BOOST_CONVERSION_ENABLE_CND)
-
- /**
- * States the default converter condition used when no constraint is associated to the @c Target and @c Source parameters.
- */
- template < typename Target, typename Source>
- struct default_converter_condition
- : is_convertible<Source,Target>
- {};
-#endif
-
- //! Customization point for @c convert_to.
- //! @tparam Target target type of the conversion.
- //! @tparam Source source type of the conversion.
- //! @tparam Enable A dummy template parameter that can be used for SFINAE.
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- template < typename Target, typename Source, class Enable = void >
- struct converter_cp : false_type {};
- template < typename Target, typename Source, class Enable = void >
- struct converter : converter_cp<Target,Source,Enable> {};
-
- //! Specialization for @c converter when @c is_convertible<Source,Target>.
- //! @Requires @c is_convertible<Source,Target>
- template < typename Target, typename Source >
- struct converter<Target, Source
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- , typename enable_if<is_convertible<Source,Target> >::type
-#endif
- > : true_type
-#else
- template < typename Target, typename Source, class Enable = void >
- struct converter_cp : true_type
-#endif
- {
- //! @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()(const Source& val)
- {
- return val;
- }
- };
-#if !defined(BOOST_CONVERSION_ENABLE_CND)
- template < typename Target, typename Source, class Enable = void >
- struct converter : converter_cp<Target,Source,Enable> {};
-#endif
-
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- namespace impl_2 {
-
- //! @brief Default @c convert_to overload, used when ADL fails.
- //!
- //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
- //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class or the copy constructor of the @c Target class throws.
- //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
- template < typename Target, typename Source >
- Target convert_to(const Source& from, dummy::type_tag<Target> const&)
- {
- return conversion::converter<Target,Source>()(from);
- }
- }
-
- namespace impl {
- template <typename Target, typename Source>
- Target convert_to_impl(Source const& from)
- {
- using namespace boost::conversion::impl_2;
- //use boost::conversion::impl_2::convert_to if ADL fails
- return convert_to(from, dummy::type_tag<Target>());
- }
- }
-#endif
-#endif
-
//! @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.
@@ -170,11 +56,7 @@
#endif
convert_to(Source const& from)
{
-#if defined(BOOST_CONVERSION_DOUBLE_CP)
- return boost::conversion::impl::convert_to_impl<Target>(from);
-#else
- return conversion::converter<Target,Source>()(from);
-#endif
+ return boost::conversion::explicit_convert_to<Target>(from);
}
}
}
Modified: sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -7,6 +7,7 @@
// See http://www.boost.org/libs/conversion for documentation.
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
Modified: sandbox/conversion/boost/conversion/convertible_from.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convertible_from.hpp (original)
+++ sandbox/conversion/boost/conversion/convertible_from.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,15 +8,16 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
- Defines the free function @c mca.
+ Defines the free function @c mcf.
*/
#ifndef BOOST_CONVERSION_CONVERTIBLE_FROM_HPP
#define BOOST_CONVERSION_CONVERTIBLE_FROM_HPP
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
#include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
#include <boost/utility/enable_if.hpp>
@@ -48,11 +49,11 @@
>
operator Target() const
{
- return conversion::convert_to<Target>(val_);
+ return conversion::implicit_convert_to<Target>(val_);
}
};
- //! @brief makes a convertible from @c Source.
+ //! @brief makes a wrapper implicitly convertible from @c Source.
//! The result provides implicitly conversion to any type which is extrinsic convertible from @c Source.
//! @NoThrow.
template <typename Source>
Modified: sandbox/conversion/boost/conversion/convertible_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convertible_to.hpp (original)
+++ sandbox/conversion/boost/conversion/convertible_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,15 +8,16 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
- Defines the free function @c mca.
+ Defines the @c convertible_to wrapper.
*/
#ifndef BOOST_CONVERSION_CONVERTIBLE_TO_HPP
#define BOOST_CONVERSION_CONVERTIBLE_TO_HPP
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
#include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
#include <boost/utility/enable_if.hpp>
@@ -41,7 +42,7 @@
, typename enable_if<boost::is_extrinsic_convertible<Source,Target> >::type* dummy = 0
#endif
)
- : val_(boost::conversion::convert_to<Target>(source))
+ : val_(boost::conversion::implicit_convert_to<Target>(source))
{}
//! Implicit conversion to @c Target.
@@ -51,7 +52,7 @@
{
return val_;
}
- //! explicit conversion to @c Target.
+ //! Explicit conversion to @c Target.
//! @Returns @c val_
//! @Throws Whatever @c target copy constructor could throw.
Target get() const
Added: sandbox/conversion/boost/conversion/detail/is_optional.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/detail/is_optional.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -0,0 +1,32 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef BOOST_CONVERSION_DETAIL_IS_OPTIONAL_HPP
+#define BOOST_CONVERSION_DETAIL_IS_OPTIONAL_HPP
+
+#include <boost/optional.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+
+namespace boost {
+
+ namespace conversion {
+ namespace detail {
+ template <typename T>
+ struct is_optional : false_type {};
+ template <typename T>
+ struct is_optional< ::boost::optional<T> > : true_type {};
+
+ }
+ }
+}
+
+#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-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -31,33 +31,27 @@
#endif
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/integral_constant.hpp>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
#include <boost/conversion/type_traits/is_explicitly_convertible.hpp>
#include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
-#endif
+#include <boost/conversion/detail/is_optional.hpp>
+#include <boost/optional.hpp>
namespace boost {
namespace conversion {
-#if defined(BOOST_CONVERSION_ENABLE_CND)
+ template <typename Target, typename Source>
+ Target
+ explicit_convert_to(Source const& from);
- /**
- * States the default explicit_converter condition used when no constraint is associated to the @c Target and @c Source parameters.
- */
- template < typename Target, typename Source>
- struct default_explicit_converter_condition
- : is_explicitly_convertible<Source,Target>
- {};
-#endif
+#if defined(BOOST_CONVERSION_ENABLE_CND) || !defined(BOOST_NO_SFINAE_EXPR)
//! Customization point for @c explicit_convert_to.
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
-#if defined(BOOST_CONVERSION_ENABLE_CND)
template < typename Target, typename Source, class Enable = void >
struct explicit_converter_cp : false_type {};
@@ -69,14 +63,11 @@
//! @Requires @c is_explicitly_convertible<Source,Target>
template < typename Target, typename Source >
struct explicit_converter<Target, Source
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- , typename enable_if<is_explicitly_convertible<Source,Target> >::type
-#endif
- > : true_type
-#else
- template < typename Target, typename Source, class Enable = void >
- struct explicit_converter_cp : true_type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_explicitly_convertible<Source,Target>::value
+ && !(detail::is_optional<Target>::value && !detail::is_optional<Source>::value)
+ ))
+ > : 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.
@@ -85,32 +76,105 @@
return Target((val));
}
};
-#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
//! Specialization for @c explicit_converter when @c is_explicitly_convertible<Source,Target>.
//! @Requires @c is_explicitly_convertible<Source,Target>
template < typename Target, typename Source >
struct explicit_converter<Target, Source
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
, typename enable_if_c<
is_extrinsic_convertible<Source,Target>::value
&& !is_explicitly_convertible<Source,Target>::value
+ && !(detail::is_optional<Target>::value && !detail::is_optional<Source>::value)
>::type
-#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.
Target operator()(const Source& val)
{
- return convert_to<Target>(val);
+ return implicit_convert_to<Target>(val);
}
};
-#endif
-#if !defined(BOOST_CONVERSION_ENABLE_CND)
+
+ //! @brief @c explicit converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
+ //!
+ //! We can see this specialization as a try_convert_to function.
+ template < class Target, class Source>
+ struct explicit_converter< optional<Target>, Source
+ , typename enable_if_c<
+// BOOST_CONVERSION_REQUIRES((
+ explicit_converter<Target,Source>::value
+ && ! detail::is_optional<Source>::value
+// ))
+ >::type
+ > : 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>();
+ }
+ }
+ };
+#else
+ //! Customization point for @c explicit_convert_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
template < typename Target, typename Source, class Enable = void >
- struct explicit_converter : explicit_converter_cp<Target,Source,Enable> {};
+ struct explicit_converter_cp : false_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.
+ Target operator()(const Source& val)
+ {
+ return Target((val));
+ }
+ };
+
+ template < typename Target, typename Source, bool TargetIsOptional, bool SourceIsOptional>
+ struct explicit_converter_aux : explicit_converter_cp<Target, Source>
+ {};
+ //! @brief @c explicit converter specialization to try to convert the source to @c Target::value_type when @c Target is optional.
+ //!
+ //! We can see this specialization as a try_convert_to function.
+ template < class Target, class Source>
+ struct explicit_converter_aux< optional<Target>, Source, true, false> : 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>();
+ }
+ }
+ };
+
+ //! Default @c explicit_converter.
+ template < typename Target, typename Source, class Enable = void >
+ struct explicit_converter : explicit_converter_aux<Target,Source,detail::is_optional<Target>::value, detail::is_optional<Source>::value> {};
+
+
+
#endif
+
#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -151,13 +215,8 @@
//! @Returns The result of @c explicit_converter customization point.
//! @Throws Whatever the @c explicit_converter call operator throws.
//!
- //! This function doesn't participate on overload resolution when @c conversion::enable_functor<Source>::type is mpl::true_.
template <typename Target, typename Source>
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- typename disable_if<typename conversion::enable_functor<Source>::type, Target>::type
-#else
Target
-#endif
explicit_convert_to(Source const& from)
{
#if defined(BOOST_CONVERSION_DOUBLE_CP)
@@ -166,6 +225,9 @@
return conversion::explicit_converter<Target,Source>()(from);
#endif
}
+
+
+
}
}
Added: sandbox/conversion/boost/conversion/implicit_convert_to.hpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/boost/conversion/implicit_convert_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -0,0 +1,141 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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 free function @c implicit_convert_to and its customization point @c converter.
+ *
+ * The @c implicit_convert_to function converts the @c from parameter to a @c Target type.
+ *
+ */
+#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>
+#include <boost/conversion/type_traits/is_convertible.hpp>
+
+namespace boost {
+ namespace conversion {
+
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
+ namespace dummy {
+ //! tag used to overload a function returning T.
+ //!
+ //! @tparam T The wrapped return type.
+ //! Users overloading the @c implicit_convert_to function must use this tag.
+ template <typename T>
+ struct type_tag
+ {
+ //! The nested type @c type names the template parameter.
+ typedef T type;
+ };
+ }
+#endif
+
+
+ //! Customization point for @c implicit_convert_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ template < typename Target, typename Source, class Enable = void >
+ struct converter_cp : false_type {};
+ //! Default customization point for @c implicit_convert_to.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ template < typename Target, typename Source, class Enable = void >
+ struct converter : converter_cp<Target,Source,Enable> {};
+
+
+ //! Specialization for @c converter when @c is_convertible<Source,Target>.
+ //! @Requires @c is_convertible<Source,Target>
+ template < typename Target, typename Source >
+ struct converter<Target, Source
+ , typename enable_if_c< is_convertible<Source,Target>::value >::type
+ > : 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.
+ Target operator()(const Source& val)
+ {
+ return val;
+ }
+ };
+
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ namespace impl_2 {
+
+ //! @brief Default @c implicit_convert_to overload, used when ADL fails.
+ //!
+ //! @Effects Converts the @c from parameter to an instance of the @c Target type, using by default the conversion operator or copy constructor.
+ //! @Throws Whatever the underlying conversion @c Target operator of the @c Source class or the copy constructor of the @c Target class throws.
+ //! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
+ template < typename Target, typename Source >
+ Target implicit_convert_to(const Source& from, dummy::type_tag<Target> const&)
+ {
+ return conversion::converter<Target,Source>()(from);
+ }
+ }
+
+ namespace impl {
+ template <typename Target, typename Source>
+ Target 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
+
+ //! @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.
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
+ //! @Params
+ //! @Param{source,source of the conversion}
+ //!
+ //! @Returns The result of @c converter customization point.
+ //! @Throws Whatever the @c converter call operator throws.
+ //!
+ template <typename Target, typename Source>
+ Target
+ implicit_convert_to(Source const& from)
+ {
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
+ return boost::conversion::impl::convert_to_impl<Target>(from);
+#else
+ return conversion::converter<Target,Source>()(from);
+#endif
+ }
+ }
+}
+
+#endif
+
Modified: sandbox/conversion/boost/conversion/include.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/include.hpp (original)
+++ sandbox/conversion/boost/conversion/include.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -18,10 +18,7 @@
#define BOOST_CONVERSION_INCLUDE_HPP
#include <boost/conversion/convert_to.hpp>
-#include <boost/conversion/explicit_convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
-#include <boost/conversion/convert_to_via.hpp>
-#include <boost/conversion/ca_wrapper.hpp>
#include <boost/conversion/convertible_to.hpp>
#include <boost/conversion/convertible_from.hpp>
#include <boost/conversion/assignable_to.hpp>
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,6 +8,8 @@
//
//////////////////////////////////////////////////////////////////////////////
+
+
/*!
@file
@brief
@@ -29,12 +31,9 @@
*/
template < class Target, class Source>
struct converter_cp< std::complex<Target>, std::complex<Source>
-#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
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
std::complex<Target> operator()(std::complex<Source> const & from)
@@ -46,12 +45,9 @@
};
template < class Target, class Source>
struct assigner_cp< std::complex<Target>, std::complex<Source>
-#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
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<Source,Target>::value
+ ))
> : true_type
{
std::complex<Target>& operator()(std::complex<Target>& to, const std::complex<Source>& from)
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -13,6 +13,7 @@
Include this file when using conversions between @c std::pair<> of convertible types.
*/
+
//[PAIR_HPP
#ifndef BOOST_CONVERSION_STD_PAIR_HPP
#define BOOST_CONVERSION_STD_PAIR_HPP
@@ -27,33 +28,29 @@
// std namespace can not be overloaded
template < class T1, class T2, class S1, class S2>
struct converter_cp< std::pair<T1,T2>, std::pair<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< std::pair<T1,T2>, std::pair<S1,S2> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ ))
> : true_type
{
std::pair<T1,T2> operator()(std::pair<S1,S2> const & from)
{
- return std::pair<T1,T2>(boost::conversion::convert_to<T1>(from.first), boost::conversion::convert_to<T2>(from.second));
+ return std::pair<T1,T2>(boost::conversion::implicit_convert_to<T1>(from.first), boost::conversion::implicit_convert_to<T2>(from.second));
}
};
template < class T1, class T2, class S1, class S2>
struct assigner_cp< std::pair<T1,T2>, std::pair<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_assigner_condition<std::pair<T1,T2>,std::pair<S1,S2> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ ))
> : true_type
{
std::pair<T1,T2>& operator()(std::pair<T1,T2>& to, const std::pair<S1,S2>& from)
{
- to.first = boost::conversion::convert_to<T1>(from.first);
- to.second = boost::conversion::convert_to<T2>(from.second);
+ to.first = boost::conversion::implicit_convert_to<T1>(from.first);
+ to.second = boost::conversion::implicit_convert_to<T2>(from.second);
return to;
}
};
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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -14,6 +14,7 @@
Include this file when using conversions from/to @c std::string.
*/
+
#ifndef BOOST_CONVERSION_STD_STRING_HPP
#define BOOST_CONVERSION_STD_STRING_HPP
@@ -31,12 +32,7 @@
// std namespace can not be overloaded
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter_cp< 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
+ struct explicit_converter_cp< std::basic_string<CharT,Traits,Alloc>, T
> : true_type
{
std::basic_string<CharT,Traits,Alloc> operator()(T const & from)
@@ -49,12 +45,7 @@
}
};
template<typename T, typename CharT, typename Traits, typename Alloc>
- struct converter_cp< 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
+ struct explicit_converter_cp< T, std::basic_string<CharT,Traits,Alloc>
> : true_type
{
T operator()(std::basic_string<CharT,Traits,Alloc> const & from)
@@ -69,11 +60,6 @@
template<typename T, typename CharT, typename Traits, typename Alloc>
struct assigner_cp< 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>&
@@ -89,11 +75,6 @@
};
template<typename T, typename CharT, typename Traits, typename Alloc>
struct assigner_cp< 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-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -8,6 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+
/*!
@file
@brief
@@ -31,12 +32,9 @@
template < class T1, class A1, class T2, class A2>
struct converter_cp< std::vector<T1,A1>, std::vector<T2,A2>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_assignable<T1,T2>::value
- //&& ! default_converter_condition< std::vector<T1,A1>, std::vector<T2,A2>>::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_assignable<T1,T2>::value
+ ))
> : true_type
{
std::vector<T1,A1> operator()(std::vector<T2,A2> const & from)
@@ -60,23 +58,14 @@
boost::reference_wrapper<std::vector<T2,A2> const>,
boost::reference_wrapper<A1 const>
>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
+ BOOST_CONVERSION_REQUIRES((
is_extrinsic_assignable<std::vector<T1,A1> >::value,
std::pair<
boost::reference_wrapper<std::vector<T2,A2> const>,
boost::reference_wrapper<A1 const>
>
-
-// && ! 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
+ ))
+ > : false_type
{
std::vector<T1,A1> operator()(
typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
@@ -93,12 +82,9 @@
template < class T1, class A1, class T2, class A2>
struct assigner_cp< std::vector<T1,A1>, std::vector<T2,A2>
-#if defined(BOOST_CONVERSION_ENABLE_CND)
- , typename enable_if_c<
- is_extrinsic_assignable<T1,T2>::value
- //&& ! default_assigner_condition< std::vector<T1,A1>, std::vector<T2,A2> >::value
- >::type
-#endif
+ BOOST_CONVERSION_REQUIRES((
+ is_extrinsic_assignable<T1,T2>::value
+ ))
> : true_type
{
std::vector<T1,A1>& operator()(
Modified: sandbox/conversion/boost/conversion/try_assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_assign_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -35,6 +35,7 @@
*/
#endif
+
#include <cstddef> //for std::size_t
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/assign_to.hpp>
@@ -55,7 +56,7 @@
//! @Returns the converted value if success or the fallback when conversion fails.
bool operator()(Target& to, const Source& from)
{
- Target rollback = to;
+ Target rollback((to));
try
{
boost::conversion::assign_to<Target>(to , from);
Modified: sandbox/conversion/boost/conversion/try_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_convert_to.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -35,6 +35,7 @@
*/
#endif
+
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/boost/optional.hpp>
Modified: sandbox/conversion/boost/conversion/type_traits/is_assignable.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_assignable.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_assignable.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -12,7 +12,6 @@
* @brief
*/
-
#ifndef BOOST_CONVERSION_TT_IS_ASSIGNABLE_HPP
#define BOOST_CONVERSION_TT_IS_ASSIGNABLE_HPP
@@ -27,13 +26,13 @@
#include <complex>
#include <string>
#include <boost/fusion/tuple.hpp>
-
#if defined(BOOST_NO_DECLTYPE)
#include <boost/typeof/typeof.hpp>
#endif // defined(BOOST_NO_DECLTYPE)
-
#endif // !defined(BOOST_IS_ASSIGNABLE)
+
+
// should be always the last #include directive
#include <boost/type_traits/detail/bool_trait_def.hpp>
@@ -43,6 +42,36 @@
namespace detail {
namespace is_assignable {
+#if 0
+#ifdef BOOST_NO_SFINAE_EXPR
+ typedef char yes_type;
+ struct no_type { char a[2]; };
+
+ template<std::size_t N>
+ struct dummy;
+
+ template <class Target, class Source>
+ struct impl
+ {
+ Target t;
+ template <typename X>
+ static yes_type
+ test(dummy<sizeof(declval<X>() = declval<Source>())>*);
+
+ template <typename X>
+ static no_type
+ test(...);
+ static const bool value = sizeof(test<Target>(0)) == sizeof(yes_type);
+
+ typedef boost::integral_constant<bool,value> type;
+ };
+#else // BOOST_NO_SFINAE_EXPR
+ template <class Target, class Source>
+ struct impl : false_type {};
+#endif // BOOST_NO_SFINAE_EXPR
+
+#else // 0
+
template <class Target, class Source>
#if !defined(BOOST_NO_DECLTYPE)
decltype((declval<Target>() = declval<Source>(), true_type()))
@@ -62,11 +91,17 @@
typedef BOOST_TYPEOF_TPL((test<T, U>(0))) type;
#endif
};
+#endif //0
}
}
BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_assignable,To,From,(::boost::detail::is_assignable::impl<To,From>::type::value))
- BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_assignable2,To,From,false)
+#else
+
+ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_assignable,To,From,BOOST_IS_ASSIGNABLE(To,From))
+
+#endif
+
template <class A1, class A2, class B1, class B2>
struct is_assignable< std::pair<A1,A2>, std::pair<B1,B2> >
: integral_constant<bool, is_assignable<A1,B1>::value && is_assignable<A2,B2>::value >
@@ -97,11 +132,7 @@
struct is_assignable< fusion::tuple<A1,A2,A3>, fusion::tuple<B1,B2,B3> >
: integral_constant<bool, is_assignable<A1,B1>::value && is_assignable<A2,B2>::value&& is_assignable<A3,B3>::value >
{};
-#else
- BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_assignable,To,From,BOOST_IS_ASSIGNABLE(To,From))
-
-#endif
}
#include <boost/type_traits/detail/bool_trait_undef.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-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -16,24 +16,26 @@
#ifndef BOOST_CONVERSION_TT_IS_CONSTRUCTIBLE_HPP
#define BOOST_CONVERSION_TT_IS_CONSTRUCTIBLE_HPP
-#if 0
+#if 1
#include <boost/config.hpp>
-//#include <boost/mpl/bool.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
-#include <cstddef>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/utility/declval.hpp>
+#include <cstddef>
+
+// For specializations as there is a bug
#include <utility>
#include <boost/array.hpp>
#include <complex>
#include <vector>
#include <boost/fusion/tuple.hpp>
+
#ifndef BOOST_IS_CONSTRUCTIBLE_ARITY_MAX
#define BOOST_IS_CONSTRUCTIBLE_ARITY_MAX 3
#endif
@@ -72,7 +74,7 @@
test(...); \
\
static const bool value = sizeof(test<T>(0)) == sizeof(type_traits_detail::true_type); \
- typedef boost::integral_constant<bool,value> type; \
+ typedef boost::integral_constant<bool,value> type; \
};
BOOST_PP_REPEAT(BOOST_IS_CONSTRUCTIBLE_ARITY_MAX, M0, ~)
@@ -84,7 +86,7 @@
#define M0(z,n,t) \
template<class T BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class A)> \
struct is_constructible<T BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, A)> \
- : boost::mpl::false_ \
+ : boost::false_type \
{ \
};
@@ -92,6 +94,10 @@
#undef M0
#endif
+ template <>
+ struct is_constructible< void> : false_type {};
+ //template <typename A1, typename A2, typename A3>
+ //struct is_constructible< void, A1, A2,A3> : false_type {};
template <class A1, class A2, class B1, class B2>
struct is_constructible< std::pair<A1,A2>, std::pair<B1,B2> >
Modified: sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -12,11 +12,10 @@
* @brief
*/
-
#ifndef BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_HPP
#define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_HPP
-#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/implicit_convert_to.hpp>
#include <boost/fusion/tuple.hpp>
namespace boost {
Modified: sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp 2011-06-19 03:41:30 EDT (Sun, 19 Jun 2011)
@@ -12,7 +12,6 @@
* @brief
*/
-
#ifndef BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_CONVERTIBLE_HPP
#define BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_HPP
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