Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65607 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2010-09-26 10:46:10


Author: viboes
Date: 2010-09-26 10:46:07 EDT (Sun, 26 Sep 2010)
New Revision: 65607
URL: http://svn.boost.org/trac/boost/changeset/65607

Log:
Opaque: opaque types have now a Base parameter
private_opaque_type allows to make explicit conversions from OT to UT (when explicit conversion operators are available)
Text files modified:
   sandbox/opaque/boost/opaque/private_opaque_type.hpp | 19 ++++++++++---------
   sandbox/opaque/boost/opaque/public_opaque_type.hpp | 10 +++-------
   2 files changed, 13 insertions(+), 16 deletions(-)

Modified: sandbox/opaque/boost/opaque/private_opaque_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/private_opaque_type.hpp (original)
+++ sandbox/opaque/boost/opaque/private_opaque_type.hpp 2010-09-26 10:46:07 EDT (Sun, 26 Sep 2010)
@@ -17,6 +17,7 @@
 
 #include <boost/type_traits/is_class.hpp>
 #include <boost/type_traits/is_base_of.hpp>
+#include <boost/mpl/and.hpp>
 
 namespace boost {
 
@@ -42,10 +43,10 @@
     template <typename Final, typename UT, typename Base>
     struct transitive_explicit_substituable
 #if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
- {};
+ : Base {};
 #else
         : detail::transitive_explicit_substituable_next_level<Final, UT, Base,
- mpl::and_<is_class<UT>, is_base_of<base_public_opaque_type, UT> >::value>
+ mpl::and_<is_class<UT>, is_base_of<base_private_opaque_type, UT> >::value>
     {
         explicit operator UT() const {
                 return Final::final(this).underlying();
@@ -53,19 +54,19 @@
     };
 #endif
         
- template <typename Final, typename T>
+ template <typename Final, typename T, typename Base=base_private_opaque_type>
     class private_opaque_type : public
             new_type< Final, T,
- typename inherited_from_undelying<T, Final,
- base_private_opaque_type
- >::type
+ transitive_explicit_substituable<Final, T,
+ typename inherited_from_undelying<T, Final, Base>::type
+ >
>
     {
         typedef
             new_type< Final, T,
- typename inherited_from_undelying<T, Final,
- base_private_opaque_type
- >::type
+ transitive_explicit_substituable<Final, T,
+ typename inherited_from_undelying<T, Final, Base>::type
+ >
>
         base_type;
     protected:

Modified: sandbox/opaque/boost/opaque/public_opaque_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/public_opaque_type.hpp (original)
+++ sandbox/opaque/boost/opaque/public_opaque_type.hpp 2010-09-26 10:46:07 EDT (Sun, 26 Sep 2010)
@@ -65,14 +65,12 @@
         }
     };
 
- template <typename Final, typename T>
+ template <typename Final, typename T, typename Base=base_public_opaque_type>
     class public_opaque_type
         : public
             new_type< Final, T,
                 transitive_substituable<Final, T,
- typename inherited_from_undelying<T, Final,
- base_public_opaque_type
- >::type
+ typename inherited_from_undelying<T, Final, Base>::type
>
>
 
@@ -80,9 +78,7 @@
         typedef
             new_type< Final, T,
                 transitive_substituable<Final, T,
- typename inherited_from_undelying<T, Final,
- base_public_opaque_type
- >::type
+ typename inherited_from_undelying<T, Final, Base>::type
>
>
         base_type;


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