Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72865 - in sandbox/conversion/boost/conversion: boost std
From: vicente.botet_at_[hidden]
Date: 2011-07-02 18:24:43


Author: viboes
Date: 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
New Revision: 72865
URL: http://svn.boost.org/trac/boost/changeset/72865

Log:
Conversion: workarround on compilers that don't support is_assignable, is_convertible, ...
Text files modified:
   sandbox/conversion/boost/conversion/boost/array.hpp | 17 +++++++++-----
   sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp | 48 +++++++++++++++++++--------------------
   sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp | 39 +++++++++++++++-----------------
   sandbox/conversion/boost/conversion/boost/interval.hpp | 17 ++++++++++++++
   sandbox/conversion/boost/conversion/boost/optional.hpp | 27 +++++++++++++---------
   sandbox/conversion/boost/conversion/boost/rational.hpp | 17 ++++++++++++++
   sandbox/conversion/boost/conversion/boost/tuple.hpp | 13 ++--------
   sandbox/conversion/boost/conversion/std/complex.hpp | 18 +++++++++++++++
   sandbox/conversion/boost/conversion/std/pair.hpp | 25 ++++++++++++++------
   sandbox/conversion/boost/conversion/std/string.hpp | 17 +++++++++-----
   sandbox/conversion/boost/conversion/std/vector.hpp | 19 ++++++++++-----
   11 files changed, 163 insertions(+), 94 deletions(-)

Modified: sandbox/conversion/boost/conversion/boost/array.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/array.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/array.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -28,19 +28,24 @@
 #include <boost/conversion/type_traits/is_extrinsic_convertible.hpp>
 #include <boost/conversion/type_traits/is_explicitly_convertible.hpp>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
+
+namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
   template < class T, std::size_t N>
   struct is_constructible< array<T,N> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
   template < class T, std::size_t N>
   struct is_constructible< array<T,N>, array<T,N> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
   template < class T, std::size_t N>
   struct is_assignable< array<T,N>&, array<T,N> const& > : true_type {};
-}
+ template < class T, std::size_t N>
+ struct is_assignable< array<T,N>, array<T,N> > : true_type {};
 #endif
-
-namespace boost {
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_duration_to_posix_time_duration.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -24,38 +24,36 @@
 #include <boost/conversion/assign_to.hpp>
 #include <boost/config.hpp>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-#define BOOST_CONVERSION_DCL_DEFAULTS3(X) \
-namespace boost \
-{ \
-template <> struct is_constructible< X > : true_type {}; \
-template <> struct is_constructible< X, X const& > : true_type {}; \
-template <> struct is_assignable< X&, X const& > : true_type {}; \
-template <> struct is_assignable< X, X > : true_type {}; \
-}
-#else
-#define BOOST_CONVERSION_DCL_DEFAULTS3(X)
-#endif
-
-BOOST_CONVERSION_DCL_DEFAULTS3(boost::posix_time::time_duration)
+namespace boost {
 
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template <> struct is_constructible< posix_time::time_duration > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template <> struct is_constructible< posix_time::time_duration, posix_time::time_duration const& > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template <> struct is_assignable< posix_time::time_duration&, posix_time::time_duration const& > : true_type {};
+ template <> struct is_assignable< posix_time::time_duration, posix_time::time_duration > : true_type {};
+#endif
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
- template < class Rep, class Period>
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template < class Rep, class Period >
   struct is_constructible< chrono::duration<Rep, Period> > : true_type {};
- template < class Rep, class Period>
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template < class Rep, class Period >
   struct is_constructible< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
- template < class Rep, class Period>
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template < class Rep, class Period >
   struct is_assignable< chrono::duration<Rep, Period>&, chrono::duration<Rep, Period> const& > : true_type {};
- template < class Rep, class Period>
+ template < class Rep, class Period >
   struct is_assignable< chrono::duration<Rep, Period>, chrono::duration<Rep, Period> > : true_type {};
-}
 #endif
-
-
-namespace boost {
+
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/chrono_time_point_to_posix_time_ptime.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -26,38 +26,35 @@
 #include <boost/conversion/assign_to.hpp>
 #include <boost/config.hpp>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-#define BOOST_CONVERSION_DCL_DEFAULTS2(X) \
-namespace boost \
-{ \
-template <> struct is_constructible< X > : true_type {}; \
-template <> struct is_constructible< X, X const& > : true_type {}; \
-template <> struct is_assignable< X&, X const& > : true_type {}; \
-template <> struct is_assignable< X, X > : true_type {}; \
-}
-#else
-#define BOOST_CONVERSION_DCL_DEFAULTS2(X)
+namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template <> struct is_constructible< boost::posix_time::ptime > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template <> struct is_constructible< boost::posix_time::ptime, boost::posix_time::ptime const& > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template <> struct is_assignable< boost::posix_time::ptime&, boost::posix_time::ptime const& > : true_type {};
+ template <> struct is_assignable< boost::posix_time::ptime, boost::posix_time::ptime > : true_type {};
 #endif
 
-BOOST_CONVERSION_DCL_DEFAULTS2(boost::posix_time::ptime)
-
-
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
   template < class Clock, class Duration>
   struct is_constructible< chrono::time_point<Clock, Duration> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
   template < class Clock, class Duration>
   struct is_constructible< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
   template < class Clock, class Duration>
   struct is_assignable< chrono::time_point<Clock, Duration>&, chrono::time_point<Clock, Duration> const& > : true_type {};
   template < class Clock, class Duration>
   struct is_assignable< chrono::time_point<Clock, Duration>, chrono::time_point<Clock, Duration> > : true_type {};
-}
 #endif
-
-
-namespace boost {
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/boost/interval.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/interval.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/interval.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -22,6 +22,23 @@
 #include <boost/conversion/assign_to.hpp>
 
 namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template < class T, class P>
+ struct is_constructible< numeric::interval<T,P> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template < class T, class P>
+ struct is_constructible< numeric::interval<T,P>, numeric::interval<T,P> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template < class T, class P>
+ struct is_assignable< numeric::interval<T,P>&, numeric::interval<T,P> const& > : true_type {};
+ template < class T, class P>
+ struct is_assignable< numeric::interval<T,P>, numeric::interval<T,P> > : true_type {};
+#endif
+
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/boost/optional.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/optional.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/optional.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -27,19 +27,24 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/utility/enable_if.hpp>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
- template < class T>
- struct is_constructible< optional<T> > : true_type {};
- template < class T>
- struct is_constructible< optional<T>, optional<T> > : true_type {};
- template < class T>
- struct is_assignable< optional<T>&, optional<T> const& > : true_type {};
-}
-#endif
 
 namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template < class T >
+ struct is_constructible< optional<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template < class T >
+ struct is_constructible< optional<T>, optional<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template < class T >
+ struct is_assignable< optional<T>, optional<T> > : true_type {};
+ template < class T >
+ struct is_assignable< optional<T>&, optional<T> const& > : true_type {};
+#endif
+
   namespace conversion {
 
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)

Modified: sandbox/conversion/boost/conversion/boost/rational.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/rational.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/rational.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -25,7 +25,24 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/utility/enable_if.hpp>
 
+
 namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template < class T>
+ struct is_constructible< rational<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template < class T>
+ struct is_constructible< rational<T>, rational<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template < class T>
+ struct is_assignable< rational<T>, rational<T> > : true_type {};
+ template < class T>
+ struct is_assignable< rational<T>&, rational<T> const& > : true_type {};
+#endif
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/boost/tuple.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/boost/tuple.hpp (original)
+++ sandbox/conversion/boost/conversion/boost/tuple.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -21,24 +21,17 @@
 #include <boost/conversion/assign_to.hpp>
 #include <boost/config.hpp>
 
-//#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+namespace boost {
+
 #if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
-namespace boost
-{
   template < class T1, class T2, class T3 >
   struct is_constructible< fusion::tuple<T1,T2,T3> > : true_type {};
-}
 #endif
 #if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
-namespace boost
-{
   template < class T1, class T2, class T3 >
   struct is_constructible< fusion::tuple<T1,T2,T3>, fusion::tuple<T1,T2,T3> > : true_type {};
-}
 #endif
-
-
-namespace boost {
+
   namespace conversion {
 #if defined(BOOST_CONVERSION_DOXYGEN_INVOKED2)
     /** @brief Added here only to favor generation of specializations with doxygen */

Modified: sandbox/conversion/boost/conversion/std/complex.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/complex.hpp (original)
+++ sandbox/conversion/boost/conversion/std/complex.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -23,7 +23,25 @@
 #include <boost/conversion/convert_to.hpp>
 #include <boost/conversion/assign_to.hpp>
 
+
+
 namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ template < class T >
+ struct is_constructible< std::complex<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ template < class T >
+ struct is_constructible< std::complex<T>, std::complex<T> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ template < class T >
+ struct is_assignable< std::complex<T>, std::complex<T> > : true_type {};
+ template < class T >
+ struct is_assignable< std::complex<T>&, std::complex<T> const& > : true_type {};
+#endif
+
   namespace conversion {
 
     /**

Modified: sandbox/conversion/boost/conversion/std/pair.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/pair.hpp (original)
+++ sandbox/conversion/boost/conversion/std/pair.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -23,19 +23,28 @@
 #include <boost/conversion/convert_to.hpp>
 #include <utility>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
-// template < class T, class U>
-// struct is_constructible< std::pair<T,U> > : true_type {};
+
+namespace boost {
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
+ //! Specialization for std::pair<T,U> default constructor
+ template < class T, class U>
+ struct is_constructible< std::pair<T,U> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+ //! Specialization for std::pair<T,U> default copy constructor
   template < class T, class U>
   struct is_constructible< std::pair<T,U>, std::pair<T,U> const& > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+ //! Specialization for std::pair<T,U> assignment operator
+ template < class T, class U>
+ struct is_assignable< std::pair<T,U>, std::pair<T,U> > : true_type {};
+ //! Specialization for std::pair<T,U> assignment operator
   template < class T, class U>
   struct is_assignable< std::pair<T,U>&, std::pair<T,U> const& > : true_type {};
-}
 #endif
-
-namespace boost {
+
+
   namespace conversion {
 
     // std namespace can not be overloaded

Modified: sandbox/conversion/boost/conversion/std/string.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/string.hpp (original)
+++ sandbox/conversion/boost/conversion/std/string.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -27,19 +27,24 @@
 #include <boost/convert/convert.hpp>
 #endif
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
+
+namespace boost {
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
   template<typename CharT, typename Traits, typename Alloc>
   struct is_constructible< std::basic_string<CharT,Traits,Alloc> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
   template<typename CharT, typename Traits, typename Alloc>
   struct is_constructible< std::basic_string<CharT,Traits,Alloc>, std::basic_string<CharT,Traits,Alloc> const& > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
   template<typename CharT, typename Traits, typename Alloc>
   struct is_assignable< std::basic_string<CharT,Traits,Alloc>&, std::basic_string<CharT,Traits,Alloc> const& > : true_type {};
-}
+ template<typename CharT, typename Traits, typename Alloc>
+ struct is_assignable< std::basic_string<CharT,Traits,Alloc>, std::basic_string<CharT,Traits,Alloc> > : true_type {};
 #endif
-
-namespace boost {
+
+
   namespace conversion {
 
     // std namespace can not be overloaded

Modified: sandbox/conversion/boost/conversion/std/vector.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/std/vector.hpp (original)
+++ sandbox/conversion/boost/conversion/std/vector.hpp 2011-07-02 18:24:42 EDT (Sat, 02 Jul 2011)
@@ -25,20 +25,25 @@
 //#include <boost/conversion/pack.hpp>
 #include <boost/conversion/type_traits/is_extrinsic_assignable.hpp>
 
-#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE) || defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
-namespace boost
-{
+
+
+namespace boost {
+
+#if defined(BOOST_CONVERSION_NO_IS_DEFAULT_CONSTRUCTIBLE)
   template < class T, class A>
   struct is_constructible< std::vector<T,A> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
   template < class T, class A>
   struct is_constructible< std::vector<T,A>, std::vector<T,A> > : true_type {};
+#endif
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
   template < class T, class A>
   struct is_assignable< std::vector<T,A>&, std::vector<T,A> const& > : true_type {};
-}
+ template < class T, class A>
+ struct is_assignable< std::vector<T,A>, std::vector<T,A> > : true_type {};
 #endif
-
-
-namespace boost {
+
   namespace conversion {
 
     // std namespace can not be overloaded


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