Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72956 - sandbox/conversion/boost/conversion/type_traits
From: vicente.botet_at_[hidden]
Date: 2011-07-07 12:50:22


Author: viboes
Date: 2011-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
New Revision: 72956
URL: http://svn.boost.org/trac/boost/changeset/72956

Log:
conversion: update comments
Text files modified:
   sandbox/conversion/boost/conversion/type_traits/is_assignable.hpp | 96 +++++++++++++++++++++++++--------------
   sandbox/conversion/boost/conversion/type_traits/is_constructible.hpp | 22 ++++++++
   sandbox/conversion/boost/conversion/type_traits/is_convertible.hpp | 4 +
   sandbox/conversion/boost/conversion/type_traits/is_copy_assignable.hpp | 26 ++++++++++
   sandbox/conversion/boost/conversion/type_traits/is_copy_constructible.hpp | 21 +++++++-
   sandbox/conversion/boost/conversion/type_traits/is_explicitly_convertible.hpp | 15 +++++
   sandbox/conversion/boost/conversion/type_traits/is_extrinsic_assignable.hpp | 2
   sandbox/conversion/boost/conversion/type_traits/is_extrinsic_convertible.hpp | 2
   sandbox/conversion/boost/conversion/type_traits/is_extrinsic_explicit_convertible.hpp | 2
   9 files changed, 143 insertions(+), 47 deletions(-)

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-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_assignable.
  */
 
 #ifndef BOOST_CONVERSION_TT_IS_ASSIGNABLE_HPP
@@ -22,6 +22,23 @@
 #include <string>
 #include <boost/fusion/tuple.hpp>
 
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+
+ /**
+ * States if the @c Target is assignable from the @c Source.
+ *
+ * Condition: @c true_type if <c>declval<Target>() = declval<Source>()</c> is well-formed when treated as an
+ * unevaluated operand.
+ *
+ * @Requires @c Target and @c Source must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ */
+ template < class Target, class Source>
+ struct is_assignable
+ {};
+}
+#else
+
 #if !defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
 
 #include <boost/type_traits/intrinsics.hpp>
@@ -114,6 +131,15 @@
 
 namespace boost {
 
+ /**
+ * States if the @c Target is assignable from the @c Source.
+ *
+ * Condition: @c true_type if <c>declval<Target>() = declval<Source>()</c> is well-formed when treated as an
+ * unevaluated operand. Access checking is performed as if in a context unrelated to T and U.
+ *
+ * @Requires @c Target and @c Source shall be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ */
+
   template < class Target, class Source>
   struct is_assignable : false_type
   {};
@@ -207,45 +233,45 @@
 
 #endif
 
-
 // These specializations are needed because the std library implementation is not using SFINAE
 namespace boost {
-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 >
- {};
-template <class T1, class T2, std::size_t N>
-struct is_assignable< boost::array<T1,N>, boost::array<T2,N> >
- : integral_constant<bool, is_assignable<T1,T2>::value >
- {};
-template < class Target, class Source>
-struct is_assignable< std::complex<Target>, std::complex<Source> >
- : integral_constant<bool, is_assignable<Target,Source>::value >
- {};
-template<typename T, typename CharT, typename Traits, typename Alloc>
-struct is_assignable< std::basic_string<CharT,Traits,Alloc>, T >
- : false_type
- {};
-
-template < class T1, class A1, class T2, class A2>
-struct is_assignable< std::vector<T1,A1>, std::vector<T2,A2> >
- : integral_constant<bool, is_assignable<T1,T2>::value >
- {};
-template <class A1, class A2, class B1, class B2>
-struct is_assignable< fusion::tuple<A1,A2>, fusion::tuple<B1,B2> >
+ 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 >
+ {};
+ template <class T1, class T2, std::size_t N>
+ struct is_assignable< boost::array<T1,N>, boost::array<T2,N> >
+ : integral_constant<bool, is_assignable<T1,T2>::value >
+ {};
+ template < class Target, class Source>
+ struct is_assignable< std::complex<Target>, std::complex<Source> >
+ : integral_constant<bool, is_assignable<Target,Source>::value >
+ {};
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct is_assignable< std::basic_string<CharT,Traits,Alloc>, T >
+ : false_type
+ {};
+
+ template < class T1, class A1, class T2, class A2>
+ struct is_assignable< std::vector<T1,A1>, std::vector<T2,A2> >
+ : integral_constant<bool, is_assignable<T1,T2>::value >
+ {};
+ template <class A1, class A2, class B1, class B2>
+ struct is_assignable< fusion::tuple<A1,A2>, fusion::tuple<B1,B2> >
+ : integral_constant<bool, is_assignable<A1,B1>::value && is_assignable<A2,B2>::value >
+ {};
+
+ template <class A1, class A2, class B1, class B2>
+ struct is_assignable< fusion::tuple<A1,A2>&, fusion::tuple<B1,B2> const&>
     : integral_constant<bool, is_assignable<A1,B1>::value && is_assignable<A2,B2>::value >
- {};
+ {};
 
- template <class A1, class A2, class B1, class B2>
- struct is_assignable< fusion::tuple<A1,A2>&, fusion::tuple<B1,B2> const&>
- : integral_constant<bool, is_assignable<A1,B1>::value && is_assignable<A2,B2>::value >
- {};
-
- template <class A1, class A2, class A3, class B1, class B2, class B3>
-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 >
- {};
+ template <class A1, class A2, class A3, class B1, class B2, class B3>
+ 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 >
+ {};
 }
+#endif
 
 #endif
 

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-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,13 +9,32 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_constructible.
  */
 
 
 #ifndef BOOST_CONVERSION_TT_IS_CONSTRUCTIBLE_HPP
 #define BOOST_CONVERSION_TT_IS_CONSTRUCTIBLE_HPP
 
+#if defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+namespace boost {
+
+ /**
+ * States if @c T is constructible from @c Args.
+ *
+ * Condition: @c true_type if and only if the following variable definition would be well-formed for
+ * some invented variable t:
+ *
+ * T t(decval<Args>()...);
+ *
+ * @Requires @c T and all types in the parameter pack @c Args must be complete types, (possibly cv-qualified) void, or arrays of unknown bound.
+ */
+ template < class T, class... Args>
+ struct is_constructible
+ {};
+}
+#else
+
 #if 1
 
 #include <boost/config.hpp>
@@ -395,4 +414,5 @@
 
 #endif
 #endif
+#endif
 

Modified: sandbox/conversion/boost/conversion/type_traits/is_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_convertible.hpp 2011-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Include this file to workaround some failures on the Boost.TypeTraits @c is_convertible.
  */
 
 
@@ -27,6 +27,7 @@
 namespace boost
 {
 
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
   template < >
   struct is_convertible< const void, void> : true_type {};
   template < >
@@ -69,6 +70,7 @@
       : integral_constant<bool, is_convertible<A1,B1>::value && is_convertible<A2,B2>::value&& is_convertible<A3,B3>::value >
         {};
 
+#endif
 }
 
 #endif

Modified: sandbox/conversion/boost/conversion/type_traits/is_copy_assignable.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_copy_assignable.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_copy_assignable.hpp 2011-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_copy_assignable.
  */
 
 
@@ -18,12 +18,34 @@
 
 #include <boost/conversion/type_traits/is_assignable.hpp>
 #include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/add_lvalue_reference.hpp>
 
 namespace boost {
 
+ /**
+ * States if @c T is copy assignable.
+ *
+ * Condition: <c>is_assignable<T&, T const&>::value</c> is @c true.
+ *
+ * @Requires @c T must be a complete type, (possibly cv-qualified) void, or an array of unknown bound.
+ */
   template <class T>
- struct is_copy_assignable : is_assignable<typename remove_reference<T>::type&, typename remove_reference<T>::type const&> {};
+ struct is_copy_assignable : is_assignable<
+ T&,
+ T const&
+ > {};
+
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+
+ /**
+ * @c is_copy_assignable specialization for reference types.
+ *
+ * Condition: references are always copy assignable.
+ */
+ template <typename T>
+ struct is_copy_assignable<T&> : true_type {};
 
+#endif
 }
 
 

Modified: sandbox/conversion/boost/conversion/type_traits/is_copy_constructible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_copy_constructible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_copy_constructible.hpp 2011-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_copy_constructible.
  */
 
 
@@ -18,20 +18,35 @@
 
 #include <boost/conversion/type_traits/is_constructible.hpp>
 #include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/add_lvalue_reference.hpp>
 #include <boost/type_traits/integral_constant.hpp>
 
 namespace boost {
 
+ /**
+ * States if @c T is copy constructible.
+ *
+ * Condition: <c>is_constructible<T, T const&>::value</c> is @c true.
+ *
+ * @Requires @c T must be a complete type, (possibly cv-qualified) void, or an array of unknown bound.
+ */
   template <class T>
   struct is_copy_constructible : is_constructible<
- typename remove_reference<T>::type,
- typename remove_reference<T>::type const&
+ T,
+ T const&
+// const typename add_lvalue_reference<T>::type
> {};
 
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
   template <>
   struct is_copy_constructible<void> : false_type {};
   template <typename T>
+ struct is_copy_constructible<T&> : true_type {};
+ template <typename T>
   struct is_copy_constructible<T[]> : false_type {};
+ template <typename T, std::size_t N>
+ struct is_copy_constructible<T[N]> : false_type {};
+#endif
 
 }
 

Modified: sandbox/conversion/boost/conversion/type_traits/is_explicitly_convertible.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/type_traits/is_explicitly_convertible.hpp (original)
+++ sandbox/conversion/boost/conversion/type_traits/is_explicitly_convertible.hpp 2011-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_explicitly_convertible.
  */
 
 
@@ -20,10 +20,21 @@
 
 namespace boost {
 
- template <class Source, class Target>
+ /**
+ * States if @c Source is explicitly convertible to @c Target.
+ *
+ * Condition: @c is_constructible<Target, Source>::value is @c true.
+ *
+ */ template <class Source, class Target>
   struct is_explicitly_convertible : is_constructible<Target, Source> {};
+
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ /**
+ * Specialization for void source
+ */
   template <class Target>
   struct is_explicitly_convertible<void,Target> : false_type {};
+#endif
 
 
 }

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-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_explicitly_convertible.
  */
 
 

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-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_extrinsic_convertible.
  */
 
 #ifndef BOOST_CONVERSION_TT_IS_EXTRINSIC_CONVERTIBLE_HPP

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-07-07 12:50:19 EDT (Thu, 07 Jul 2011)
@@ -9,7 +9,7 @@
 //////////////////////////////////////////////////////////////////////////////
 /**
  * @file
- * @brief
+ * @brief Defines the type trait @c is_extrinsic_explicit_convertible.
  */
 
 #ifndef BOOST_CONVERSION_TT_IS_EXTRINSIC_EXPLICIT_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