|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72770 - in sandbox/conversion/boost/conversion: . std type_traits
From: vicente.botet_at_[hidden]
Date: 2011-06-26 18:19:22
Author: viboes
Date: 2011-06-26 18:19:20 EDT (Sun, 26 Jun 2011)
New Revision: 72770
URL: http://svn.boost.org/trac/boost/changeset/72770
Log:
Conversion: Update comments
Text files modified:
sandbox/conversion/boost/conversion/assign_to.hpp | 96 +++++++++++++++++++++++++++++++--------
sandbox/conversion/boost/conversion/convert_to.hpp | 12 ++--
sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 28 +++++++---
sandbox/conversion/boost/conversion/convertible_from.hpp | 3
sandbox/conversion/boost/conversion/explicit_convert_to.hpp | 25 +++++++++
sandbox/conversion/boost/conversion/implicit_convert_to.hpp | 10 ++++
sandbox/conversion/boost/conversion/std/pair.hpp | 28 +++++++++--
sandbox/conversion/boost/conversion/std/string.hpp | 15 ++++++
sandbox/conversion/boost/conversion/std/vector.hpp | 39 +++------------
sandbox/conversion/boost/conversion/try_assign_to.hpp | 7 ++
sandbox/conversion/boost/conversion/try_convert_to.hpp | 2
sandbox/conversion/boost/conversion/type_traits/is_extrinsic_assignable.hpp | 3 +
sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp | 5 ++
sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp | 5 ++
14 files changed, 202 insertions(+), 76 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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -46,22 +46,31 @@
#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
//! Customization point for @c assign_to.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
+ //! This class must be specialized by the user when the default behavior of @c explicit_converter is not satisfying.
template < typename Target, typename Source, class Enable = void>
struct assigner_cp : false_type {};
//! Default customization point for @c assign_to.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
//! By default it delegates to the user @c assigner_cp.
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.
+ //!
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
* @Requires @c Target must be CopyAssinable and @c @c Source must be extrinsic convertible to @c Target.
*/
template < typename Target, typename Source>
@@ -87,6 +96,10 @@
};
/**
* Specialization when @c Target is assignable from @c Source.
+ *
+ * @tparam Target target type of the conversion.
+ * @tparam Source source type of the conversion.
+ *
* @Requires @c Target must be Assinable from Source.
*/
template < typename Target, typename Source>
@@ -109,31 +122,59 @@
}
};
+ /**
+ * Partial specialization for c-array types.
+ *
+ * @tparam Target target type of the conversion.
+ * @tparam Source source type of the conversion.
+ * @tparam N the size of the c-arrays.
+ *
+ * @Requires @c Target must be Assinable from @c Source.
+ */
+ template < typename Target, typename Source, std::size_t N >
+ struct assigner<Target[N],Source[N]
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ , requires(Assignable<Target,Source>)
#else
- template < typename Target, typename Source, class Enable = void>
- struct assigner_cp : true_type
+ , typename enable_if_c<
+ is_assignable<Target, Source>::value
+ >::type
+#endif
+ > : 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)
+ //! @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.
+ //! @Basic
+ Target*& operator()(Target(&to)[N], const Source(& from)[N])
{
- to = ::boost::conversion::implicit_convert_to<Target>(from);
+ for (std::size_t i = 0; i < N; ++i)
+ {
+ to[i] = from[i];
+ }
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.
+ /**
+ * Partial specialization for c-array types.
+ *
+ * @tparam Target target type of the conversion.
+ * @tparam Source source type of the conversion.
+ * @tparam N the size of the c-arrays.
+ *
+ * @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]
- BOOST_CONVERSION_REQUIRES((
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ , requires(CopyAssignable<Target> && ExtrinsicConvertible<Source,Target>)
+#else
+ , typename enable_if_c<
is_copy_assignable<Target>::value
&& is_extrinsic_convertible<Source,Target>::value
&& ! is_assignable<Target,Source>::value
- ))
+ >::type
+#endif
> : 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.
@@ -149,14 +190,27 @@
}
};
-#if defined(BOOST_CONVERSION_ENABLE_CND) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- //! partial specialization for c-array types.
- //! @Requires @c Target must be Assinable from @c Source.
+
+#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> {};
+
+ //! 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]
- 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.
@@ -166,13 +220,15 @@
{
for (std::size_t i = 0; i < N; ++i)
{
- to[i] = from[i];
+ to[i] = ::boost::conversion::implicit_convert_to<Target>(from[i]);
}
return to;
}
};
+
#endif
+
}
#if defined(BOOST_CONVERSION_DOUBLE_CP)
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -10,7 +10,7 @@
/**
* @file
- * @brief Defines the free function @c convert_to and its customization point @c converter.
+ * @brief Defines the free function @c convert_to.
*
* The @c convert_to function converts the @c from parameter to a @c Target type.
*
@@ -29,23 +29,23 @@
//! @tparam T The type to check for.
//! @tparam Enable A dummy parameter that can be used for SFINAE.
- //! The nested type @c type is a mpl boolean which default to @c mpl::false_.
- //! Specific specialization would make this meta-function to be @c mpl::true_.
+ //! The nested type @c type is @c false_type or @c true_type which default to @c false_type.
+ //! Specific specialization would make this meta-function to be @c true_type.
template <typename T, typename Enabled=void>
struct enable_functor : false_type {};
//! @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.
+ //! This function can be seen as an emulation of free function overload of the explicit 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.
+ //! @Returns The result of @c explicit_convert_to<Target>(from).
+ //! @Throws Whatever the @c explicit_convert_to<Target>(from) throws.
//!
//! This function doesn't participate on overload resolution when @c conversion::enable_functor<Source>::type is mpl::true_.
template <typename Target, typename Source>
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -11,11 +11,15 @@
/*!
@file
@brief
- Defines the free function @c convert_to_or_fallback.
+ Defines the free function @c convert_to_or_fallback and its customization point @c converter_or_fallbacker_cp.
The @c convert_to_or_fallback function converts the @c from parameter to a @c Target type. If the conversion fails the fallback value is used to construct a Target @c instance.
*/
+
+#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
@@ -33,38 +37,44 @@
*/
#endif
-#ifndef BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
-#define BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
-
+#include <boost/conversion/config.hpp>
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
namespace conversion {
-#if defined(BOOST_CONVERSION_ENABLE_CND) || !defined(BOOST_NO_SFINAE_EXPR)
+#if defined(BOOST_CONVERSION_ENABLE_CND) || !defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ //! Customization point for @c convert_to_or_fallback.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
+ //! This class must be specialized by the user.
template < typename Target, typename Source, typename Fallback=Target, class Enable = void>
- struct converter_or_fallbacker_cp;
+ struct converter_or_fallbacker_cp {};
- //! Default @c explicit_converter.
+ //! Default @c converter_or_fallbacker.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
+ //! The default implementation relies on the @c converter_or_fallbacker_cp which must be specialized by the user.
template < typename Target, typename Source, typename Fallback=Target, class Enable = void>
struct converter_or_fallbacker : converter_or_fallbacker_cp<Target,Source,Fallback,Enable> {};
//! Specialization for @c converter_or_fallbacker when
//! @c is_extrinsic_explicitly_convertible<Source,Target>
//! @c && is_extrinsic_explicitly_convertible<Fallback,Target>.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
- //! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
//! @Requires @c is_extrinsic_explicitly_convertible<Source,Target> && @c is_extrinsic_explicitly_convertible<Fallback,Target>.
template < typename Target, typename Source, typename Fallback>
struct converter_or_fallbacker<Target, Source, Fallback,
@@ -98,7 +108,7 @@
//! @tparam Fallback type of the fallback value which must be explicitly convertible to @c Target.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
template < typename Target, typename Source, typename Fallback=Target, class Enable = void>
- struct converter_or_fallbacker_cp;
+ struct converter_or_fallbacker_cp {};
//! Default @c converter_or_fallbacker.
//! @tparam Target target type of the conversion.
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -43,7 +43,7 @@
//! @Remark On compilers that supports C++0x default arguments for function template parameters,
//! this constructor doesn't participates on overload resolution if @c Source is not extrinsic convertible to @c Target.
template <typename Target
-#if defined(BOOST_CONVERSION_ENABLE_CND) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
+#if (defined(BOOST_CONVERSION_ENABLE_CND) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS))
, typename boost::enable_if< boost::is_extrinsic_convertible<Source,Target>, int >::type = 0
#endif
>
@@ -55,6 +55,7 @@
};
//! @brief makes a wrapper implicitly convertible from @c Source.
//! The result provides implicitly conversion to any type which is extrinsic convertible from @c Source.
+ //! @Returns convertible_from<Source>(s).
//! @NoThrow.
template <typename Source>
convertible_from<Source> mcf(Source s)
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -47,19 +47,32 @@
explicit_convert_to(Source const& from);
-#if defined(BOOST_CONVERSION_ENABLE_CND) || !defined(BOOST_NO_SFINAE_EXPR)
+#if defined(BOOST_CONVERSION_ENABLE_CND) || !defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
//! 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.
+ //!
+ //! This class must be specialized by the user when the default behavior of @c explicit_converter is not satisfying.
template < typename Target, typename Source, class Enable = void >
struct explicit_converter_cp : false_type {};
//! Default @c explicit_converter.
+ //!
+ //! @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.
+ //!
+ //! The default implementation relies on the @c explicit_converter_cp which must be specialized by the user.
template < typename Target, typename Source, class Enable = void >
struct explicit_converter : explicit_converter_cp<Target,Source,Enable> {};
//! Specialization for @c explicit_converter when @c is_explicitly_convertible<Source,Target>.
+ //!
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
//! @Requires @c is_explicitly_convertible<Source,Target>
template < typename Target, typename Source >
struct explicit_converter<Target, Source,
@@ -81,6 +94,10 @@
}
};
//! Specialization for @c explicit_converter when @c is_explicitly_convertible<Source,Target>.
+ //!
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
//! @Requires @c is_extrinsic_convertible<Source,Target>
template < typename Target, typename Source >
struct explicit_converter<Target, Source,
@@ -104,6 +121,10 @@
};
//! @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_extrinsic_explicit_convertible<Source,Target>
//! We can see this specialization as a try_convert_to function.
template < class Target, class Source>
@@ -140,7 +161,7 @@
//! @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_cp : false_type
+ struct explicit_converter_cp : 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.
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-06-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -56,21 +56,31 @@
//! 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.
+ //!
+ //! This class must be specialized by the user when the default behavior of @c explicit_converter is not satisfying.
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.
+ //!
+ //! The default implementation relies on the @c converter_cp which must be specialized by the user.
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>.
+ //!
+ //! @tparam Target target type of the conversion.
+ //! @tparam Source source type of the conversion.
+ //!
//! @Requires @c is_convertible<Source,Target>
template < typename Target, typename Source >
struct converter<Target, Source
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -18,20 +18,32 @@
#ifndef BOOST_CONVERSION_STD_PAIR_HPP
#define BOOST_CONVERSION_STD_PAIR_HPP
-#include <utility>
-//#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/config.hpp>
#include <boost/conversion/assign_to.hpp>
+#include <boost/conversion/convert_to.hpp>
+#include <utility>
namespace boost {
namespace conversion {
// std namespace can not be overloaded
+
+ /**
+ * Partial specialization of @c converter_cp for @c std::pair of extrinsic convertibles.
+ */
template < class T1, class T2, class S1, class S2>
struct converter_cp< std::pair<T1,T2>, std::pair<S1,S2>
- BOOST_CONVERSION_REQUIRES((
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ , typename enable_if_c<
is_extrinsic_convertible<S1,T1>::value
- && is_extrinsic_convertible<S2,T2>::value
- ))
+ && is_extrinsic_convertible<S2,T2>::value
+ >::type
+#elif defined(BOOST_CONVERSION_ENABLE_CND)
+ , typename enable_if_c<
+ is_extrinsic_convertible<S1,T1>::value
+ && is_extrinsic_convertible<S2,T2>::value
+ >::type
+#endif
> : true_type
{
std::pair<T1,T2> operator()(std::pair<S1,S2> const & from)
@@ -39,6 +51,11 @@
return std::pair<T1,T2>(boost::conversion::implicit_convert_to<T1>(from.first), boost::conversion::implicit_convert_to<T2>(from.second));
}
};
+
+#if !defined(BOOST_CONVERSION_ENABLE_CND)
+ /**
+ * Partial specialization of @c assigner_cp for @c std::pair of extrinsic convertibles.
+ */
template < class T1, class T2, class S1, class S2>
struct assigner_cp< std::pair<T1,T2>, std::pair<S1,S2>
BOOST_CONVERSION_REQUIRES((
@@ -54,6 +71,7 @@
return to;
}
};
+#endif
}
}
Modified: sandbox/conversion/boost/conversion/std/string.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/string.hpp (original)
+++ sandbox/conversion/boost/conversion/std/string.hpp 2011-06-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -31,6 +31,9 @@
// std namespace can not be overloaded
+ /**
+ * Partial specialization of @c explicit_converter_cp for convertibles to std::string.
+ */
template<typename T, typename CharT, typename Traits, typename Alloc>
struct explicit_converter_cp< std::basic_string<CharT,Traits,Alloc>, T
> : true_type
@@ -44,6 +47,10 @@
#endif
}
};
+
+ /**
+ * Partial specialization of @c explicit_converter_cp for convertibles from std::string.
+ */
template<typename T, typename CharT, typename Traits, typename Alloc>
struct explicit_converter_cp< T, std::basic_string<CharT,Traits,Alloc>
> : true_type
@@ -58,6 +65,10 @@
}
};
+#if !defined(BOOST_CONVERSION_ENABLE_CND)
+ /**
+ * Partial specialization of @c assigner_cp for convertibles to std::string.
+ */
template<typename T, typename CharT, typename Traits, typename Alloc>
struct assigner_cp< std::basic_string<CharT,Traits,Alloc>, T
> : true_type
@@ -69,6 +80,9 @@
return to;
}
};
+ /**
+ * Partial specialization of @c assigner_cp for convertibles from std::string.
+ */
template<typename T, typename CharT, typename Traits, typename Alloc>
struct assigner_cp< T, std::basic_string<CharT,Traits,Alloc>
> : true_type
@@ -79,6 +93,7 @@
return to;
}
};
+#endif
}
}
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -30,6 +30,9 @@
// std namespace can not be overloaded
+ /**
+ * Partial specialization of @c converter_cp for @c std::vector of extrinsic convertibles.
+ */
template < class T1, class A1, class T2, class A2>
struct converter_cp< std::vector<T1,A1>, std::vector<T2,A2>
BOOST_CONVERSION_REQUIRES((
@@ -48,38 +51,11 @@
return to;
}
};
-#if 0
-
- template < class T1, class A1, class T2, class A2>
- struct converter_cp< std::vector<T1,A1>,
- //~ typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
- //~ boost::fusion::tuple<
- std::pair<
- boost::reference_wrapper<std::vector<T2,A2> const>,
- boost::reference_wrapper<A1 const>
- >
- 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>
- >
- ))
- > : false_type
- {
- std::vector<T1,A1> operator()(
- typename boost::conversion::result_of::pack2<std::vector<T2,A2> const, A1 const>::type
- const & pack)
- {
- std::vector<T1,A1> res(fusion::at_c<1>(pack).get());
- boost::conversion::assign_to(res, fusion::at_c<0>(pack).get());
- //std::vector<T1,A1> res(pack.second.get());
- //boost::conversion::assign_to(res, pack.first.get());
- return res;
- }
- };
-#endif
+#if !defined(BOOST_CONVERSION_ENABLE_CND)
+ /**
+ * Partial specialization of @c assigner_cp for @c std::vector of extrinsic convertibles.
+ */
template < class T1, class A1, class T2, class A2>
struct assigner_cp< std::vector<T1,A1>, std::vector<T2,A2>
BOOST_CONVERSION_REQUIRES((
@@ -98,6 +74,7 @@
return to;
}
};
+#endif
}
}
Modified: sandbox/conversion/boost/conversion/try_assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_assign_to.hpp 2011-06-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -43,17 +43,20 @@
namespace boost {
namespace conversion {
//! Customization point for @c try_assign_to.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
//! This struct can be specialized by the user.
template < typename Target, typename Source, class Enable = void >
struct try_assigner
{
//! @Requires @c Target must be CopyConstructible and @c ::boost::conversion::assign_to(to, from) must be well formed.
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assignment operator.
//! @NoThrow
- //! @Returns the converted value if success or the fallback when conversion fails.
+ //! @Returns whether the assignment succeeded.
+ //! @Remarks The parameter to is not updated if the conversion fails.
bool operator()(Target& to, const Source& from)
{
Target rollback((to));
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -42,9 +42,11 @@
namespace boost {
namespace conversion {
//! Customization point for @c try_convert_to.
+ //!
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
//! @tparam Enable A dummy template parameter that can be used for SFINAE.
+ //!
//! This struct can be specialized by the user.
template < typename Target, typename Source, class Enable = void >
struct try_converter {
Modified: sandbox/conversion/boost/conversion/type_traits/is_extrinsic_assignable.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_extrinsic_assignable.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_extrinsic_assignable.hpp 2011-06-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -20,6 +20,9 @@
namespace boost {
+ /**
+ * trait-type that is @c true_type when @c Target is extrinsic assignable from @c Source.
+ */
template <class Target, class Source>
struct is_extrinsic_assignable : conversion::assigner<Target, Source> {};
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -20,8 +20,12 @@
namespace boost {
+ /**
+ * trait-type that is @c true_type when @c Source is extrinsic implicit convertible to @c Target.
+ */
template <class Source, class Target>
struct is_extrinsic_convertible : conversion::converter<Target, Source> {};
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
template <class T>
struct is_extrinsic_convertible<fusion::void_,T> : false_type {};
template <>
@@ -32,6 +36,7 @@
struct is_extrinsic_convertible<void, const void> : true_type {};
template <>
struct is_extrinsic_convertible<const void, const void> : true_type {};
+#endif
}
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-26 18:19:20 EDT (Sun, 26 Jun 2011)
@@ -20,8 +20,12 @@
namespace boost {
+ /**
+ * trait-type that is @c true_type when @c Source is extrinsic explicit convertible to @c Target.
+ */
template <class Source, class Target>
struct is_extrinsic_explicit_convertible : conversion::explicit_converter<Target, Source> {};
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
template <class T>
struct is_extrinsic_explicit_convertible<fusion::void_,T> : false_type {};
template <>
@@ -32,6 +36,7 @@
struct is_extrinsic_explicit_convertible<void, const void> : true_type {};
template <>
struct is_extrinsic_explicit_convertible<const void, const void> : true_type {};
+#endif
}
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