|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72346 - in sandbox/conversion/boost/conversion: . boost
From: vicente.botet_at_[hidden]
Date: 2011-06-02 11:25:26
Author: viboes
Date: 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
New Revision: 72346
URL: http://svn.boost.org/trac/boost/changeset/72346
Log:
Conversion: making double CP conditional
Text files modified:
sandbox/conversion/boost/conversion/assign_to.hpp | 6 ++++++
sandbox/conversion/boost/conversion/boost/array.hpp | 6 ++++--
sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 4 +++-
sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 2 ++
sandbox/conversion/boost/conversion/boost/interval.hpp | 3 +++
sandbox/conversion/boost/conversion/boost/optional.hpp | 2 ++
sandbox/conversion/boost/conversion/boost/rational.hpp | 2 ++
sandbox/conversion/boost/conversion/boost/tuple.hpp | 2 ++
sandbox/conversion/boost/conversion/convert_to.hpp | 9 ++++++++-
sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 14 ++++++++++----
sandbox/conversion/boost/conversion/try_assign_to.hpp | 6 ++++++
sandbox/conversion/boost/conversion/try_convert_to.hpp | 12 ++++++++----
12 files changed, 56 insertions(+), 12 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-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -66,6 +66,7 @@
};
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion_impl_2 {
@@ -91,6 +92,7 @@
}
}
#endif
+#endif
namespace conversion {
//! @brief Extrinsic assign function.
@@ -108,7 +110,11 @@
template <typename Target, typename Source>
Target& assign_to(Target& to, const Source& from)
{
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
return boost::conversion_impl::assign_to_impl<Target, Source>(to, from);
+#else
+ return conversion::assigner<Target,Source>()(to, from);
+#endif
}
}
}
Modified: sandbox/conversion/boost/conversion/boost/array.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/array.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/array.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -58,7 +58,8 @@
};
}
- #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+#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.
//!
//! @Effects converts each one of the source array elements and store the result in the corresponding index on the target array.
@@ -68,7 +69,8 @@
{
return conversion::assigner<array<Target,N>, array<Source,N> >()(to, from);
}
- #endif
+#endif
+#endif
}
#endif
Modified: sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -62,6 +62,7 @@
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
namespace chrono {
@@ -92,7 +93,8 @@
}
}
- #endif
+#endif
+#endif
}
#endif
Modified: sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -61,6 +61,7 @@
};
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
namespace chrono {
template < class Clock, class Duration>
@@ -80,6 +81,7 @@
}
}
#endif
+#endif
}
#endif
Modified: sandbox/conversion/boost/conversion/boost/interval.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/interval.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/interval.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -44,6 +44,8 @@
}
};
}
+
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
namespace numeric {
template < class Target, class PTarget, class Source, class PSource>
@@ -53,6 +55,7 @@
}
}
#endif
+#endif
}
#endif
Modified: sandbox/conversion/boost/conversion/boost/optional.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/optional.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/optional.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -80,6 +80,7 @@
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
//! @brief @c assign_to overloading for source and target been @c boost::optional.
//!
@@ -93,6 +94,7 @@
return to;
}
#endif
+#endif
}
Modified: sandbox/conversion/boost/conversion/boost/rational.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/rational.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/rational.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -48,6 +48,7 @@
};
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template < class Target, class Source>
inline rational<Target>& assign_to(rational<Target>& to, const rational<Source>& from)
@@ -55,6 +56,7 @@
return conversion::assigner<rational<Target>, rational<Source> >()(to, from);
}
#endif
+#endif
}
Modified: sandbox/conversion/boost/conversion/boost/tuple.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/tuple.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/tuple.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -49,6 +49,7 @@
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
namespace fusion {
#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
@@ -73,6 +74,7 @@
}
#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-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -35,6 +35,7 @@
namespace boost {
namespace conversion {
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
namespace dummy {
//! tag used to overload a function returning T.
//!
@@ -47,7 +48,7 @@
typedef T type;
};
}
-
+#endif
//! meta-function to state if the parameter is a place_holder
//!
//! @tparam T The type to check for.
@@ -73,6 +74,7 @@
return Target((val));
}
};
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -96,6 +98,7 @@
}
}
#endif
+#endif
//! @brief Extrinsic conversion function.
//!
@@ -120,7 +123,11 @@
Target
#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
}
}
}
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-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -62,7 +62,8 @@
}
};
- #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
//! @brief Default @c convert_to_or_fallback overload, used when ADL fails.
@@ -72,8 +73,8 @@
//! @NoThrow
//! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
template < typename Target, typename Source, typename Fallback >
- Target convert_to_or_fallback(const Source& val, Fallback const& fallback, dummy::type_tag<Target> const&) {
- return conversion::converter_or_fallbacker<Target,Source,Fallback>()(val, fallback);
+ Target convert_to_or_fallback(const Source& from, Fallback const& fallback, dummy::type_tag<Target> const&) {
+ return conversion::converter_or_fallbacker<Target,Source,Fallback>()(from, fallback);
}
}
@@ -85,7 +86,8 @@
return convert_to_or_fallback(from, fallback, dummy::type_tag<Target>());
}
}
- #endif
+#endif
+#endif
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
@@ -99,7 +101,11 @@
//! A trick is used to partially specialize on the return type by adding a dummy parameter.
template <typename Target, typename Source, typename Fallback>
Target convert_to_or_fallback(Source const& from, Fallback const& fallback) {
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
return conversion::impl::convert_to_or_fallback_impl<Target>(from, fallback);
+#else
+ return conversion::converter_or_fallbacker<Target,Source,Fallback>()(from, fallback);
+#endif
}
}
}
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-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -92,6 +92,7 @@
}
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace conversion_impl_2 {
//! @brief Default @c try_assign_to overload, used when ADL fails.
@@ -117,6 +118,7 @@
}
}
#endif
+#endif
namespace conversion {
//! @tparam Target target type of the conversion.
@@ -129,7 +131,11 @@
template <typename Target, typename Source>
bool try_assign_to(Target& to, const Source& from)
{
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
return conversion_impl::try_assign_to_impl<Target, Source>(to, from);
+#else
+ return conversion::try_assigner<Target,Source>()(to, from);
+#endif
}
}
}
Modified: sandbox/conversion/boost/conversion/try_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_convert_to.hpp 2011-06-02 11:25:25 EDT (Thu, 02 Jun 2011)
@@ -62,7 +62,7 @@
}
};
-
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
namespace impl_2 {
@@ -73,8 +73,8 @@
//! @Returns A optional<Target> uninitialized when conversion fails.
//! Forwards the call to the overload workaround, which can yet be specialized by the user for standard C++ types.
template < typename Target, typename Source >
- optional<Target> try_convert_to(const Source& val, dummy::type_tag<Target> const&) {
- return conversion::try_converter<Target,Source>()(val);
+ optional<Target> try_convert_to(const Source& from, dummy::type_tag<Target> const&) {
+ return conversion::try_converter<Target,Source>()(from);
}
}
namespace impl {
@@ -86,7 +86,7 @@
}
}
#endif
-
+#endif
//! @tparam Target target type of the conversion.
//! @tparam Source source type of the conversion.
@@ -99,7 +99,11 @@
//! A trick is used to partially specialize on the return type by adding a dummy parameter.
template <typename Target, typename Source>
optional<Target> try_convert_to(Source const& from) {
+#if defined(BOOST_CONVERSION_DOUBLE_CP)
return boost::conversion::impl::try_convert_to_impl<Target>(from);
+#else
+ return conversion::try_converter<Target,Source>()(from);
+#endif
}
}
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