|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72322 - sandbox/conversion/boost/conversion
From: vicente.botet_at_[hidden]
Date: 2011-06-01 06:50:34
Author: viboes
Date: 2011-06-01 06:50:33 EDT (Wed, 01 Jun 2011)
New Revision: 72322
URL: http://svn.boost.org/trac/boost/changeset/72322
Log:
Conversion: update comments
Text files modified:
sandbox/conversion/boost/conversion/convert_to.hpp | 5 ++---
sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 17 ++++++++---------
sandbox/conversion/boost/conversion/try_convert_to.hpp | 40 ++++++++--------------------------------
3 files changed, 18 insertions(+), 44 deletions(-)
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-01 06:50:33 EDT (Wed, 01 Jun 2011)
@@ -42,7 +42,6 @@
//! Users overloading the @c convert_to function must use this tag.
template <typename T>
struct type_tag
- //: public base_tag<T>
{
//! The nested type @c type names the template parameter.
typedef T type;
@@ -85,8 +84,8 @@
//! @Throws Whatever the underlying conversion @c To operator of the @c From class or the copy constructor of the @c To class throws.
//! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
template < typename To, typename From >
- To convert_to(const From& val, dummy::type_tag<To> const&) {
- return conversion::overload_workaround::convert_to<To,From>::apply(val);
+ To convert_to(const From& from, dummy::type_tag<To> const&) {
+ return conversion::overload_workaround::convert_to<To,From>::apply(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-01 06:50:33 EDT (Wed, 01 Jun 2011)
@@ -19,16 +19,15 @@
Of course if both exist the conversion is ambiguous.
A user adapting another type could need to specialize the @c convert_to_or_fallback free function if the default behavior is not satisfactory.
-The user can add the @c convert_to_or_fallback 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.
+ * A user adapting another type could need to overload the @c convert_to_or_fallback free function
+ * if the default behavior is not satisfactory.
+ * The user can add the @c convert_to_or_fallback 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_or_fallback struct.
-But sometimes, as it is the case for the standard classes,
-we can not add new functions on the std namespace, so we need a different technique.
-
-The technique consists in partially specialize on the function @c convert_to_or_fallback on the @c boost::conversion namespace.
-For compilers for which we can not partially specialize a function a trick is used: instead of calling directly to the @c convert_to_or_fallback member function,
-_at_c convert_to_or_fallback calls to the static operation apply on a class with the same name in the namespace @c overload_workaround.
-Thus the user can specialize partially this class.
*/
#ifndef BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
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-01 06:50:33 EDT (Wed, 01 Jun 2011)
@@ -19,16 +19,15 @@
Of course if both exist the conversion is ambiguous.
A user adapting specific types could need to specialize the @c try_convert_to free function if the default behavior is not satisfactory or if the specialization can perform better.
-The user can add the @c try_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.
+ * A user adapting another type could need to overload the @c try_convert_to free function
+ * if the default behavior is not satisfactory.
+ * The user can add the @c try_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::try_convert_to struct.
-But sometimes, as it is the case for the standard classes,
-we can not add new functions on the std namespace, so we need a different technique.
-
-The technique consists in partially specialize on the function @c try_convert_to on the @c boost::conversion namespace.
-For compilers for which we can not partially specialize a function a trick is used: instead of calling directly to the @c try_convert_to member function,
-_at_c try_convert_to calls to the static operation apply on a class with the same name in the namespace @c overload_workaround.
-Thus the user can specialize partially this class.
*/
#ifndef BOOST_CONVERSION_TRY_CONVERT_TO_HPP
@@ -40,29 +39,6 @@
namespace boost {
namespace conversion {
namespace overload_workaround {
-#if 0
- //! @brief @c convert_to specialization to try to convert the source to @c Target::value_type when @c Target is optional.
- //!
- //! We can see this specialization as a try_convert_to function.
- template < class Target, class Source>
- struct convert_to< optional<Target>, Source>
- {
- //! @Returns If the source is convertible to the target @c value_type
- //! @c Target initialized to the result of the conversion.
- //! Uninitialized @c Target otherwise.
- inline static optional<Target> apply(Source const & from)
- {
- try
- {
- return optional<Target>(boost::conversion::convert_to<Target>(from));
- }
- catch (...)
- {
- return optional<Target>();
- }
- }
- };
-#endif
//! <c>struct try_convert_to</c> used when overloading can not be applied.
//! This struct can be specialized by the user.
template < typename To, typename From >
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk