Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69305 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2011-02-26 09:19:33


Author: viboes
Date: 2011-02-26 09:19:31 EST (Sat, 26 Feb 2011)
New Revision: 69305
URL: http://svn.boost.org/trac/boost/changeset/69305

Log:
Opaque: Added NEW_CLASS and NEW_TYPE variadic macros + macros simplification
Text files modified:
   sandbox/opaque/boost/opaque/macros.hpp | 48 ++++++++++++++++++---------------------
   sandbox/opaque/boost/opaque/new_class.hpp | 5 ++-
   sandbox/opaque/boost/opaque/new_type.hpp | 16 ++++++------
   3 files changed, 33 insertions(+), 36 deletions(-)

Modified: sandbox/opaque/boost/opaque/macros.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/macros.hpp (original)
+++ sandbox/opaque/boost/opaque/macros.hpp 2011-02-26 09:19:31 EST (Sat, 26 Feb 2011)
@@ -20,16 +20,19 @@
 #include <boost/opaque/private_opaque_class.hpp>
 #include <boost/opaque/public_opaque_class.hpp>
 
-#define BOOST_OPAQUE_PUBLIC_FORWARD_CONSTRUCTORS(UT, OT) \
+#define BOOST_OPAQUE_FORWARD_CONSTRUCTORS(OT,BASE) \
     OT(){} \
     template <typename W> \
     explicit OT(W w) \
- : boost::opaque::public_opaque_class<OT, UT>(w) \
+ : BASE(w) \
     {}\
     OT(OT const& r) \
- : boost::opaque::public_opaque_class<OT, UT>(r) \
+ : BASE(r.val_) \
     {}
 
+#define BOOST_OPAQUE_PUBLIC_FORWARD_CONSTRUCTORS(UT, OT) \
+ BOOST_OPAQUE_FORWARD_CONSTRUCTORS(OT,(boost::opaque::public_opaque_class<OT, UT>))
+
 #define BOOST_OPAQUE_PUBLIC_OPERATIONS(UT, OT) \
     BOOST_OPAQUE_PUBLIC_FORWARD_CONSTRUCTORS(UT,OT)\
 
@@ -48,42 +51,22 @@
 #define BOOST_OPAQUE_EXT_PUBLIC_CLASS(UT, NT1, B) \
 struct NT1 : boost::opaque::public_opaque_class<NT1, UT,B> \
 { \
- typedef \
- boost::opaque::public_opaque_class<NT1, UT,B> \
- base_type; \
- \
- NT1(){} \
- explicit NT1(UT v) : base_type(v) {} \
- template <typename W> \
- explicit NT1(W w) \
- : base_type(w) \
- {} \
- NT1(NT1 const& r) \
- : base_type(r.val_) \
- {} \
+ BOOST_OPAQUE_FORWARD_CONSTRUCTORS(NT1, (boost::opaque::public_opaque_class<NT1, UT,B>)) \
 }
 
 #define BOOST_OPAQUE_BOOLEAN_PUBLIC_CLASS(UT, OT) \
   BOOST_OPAQUE_EXT_PUBLIC_CLASS(UT, OT, boost::opaque::boolean)
 
-#define BOOST_OPAQUE_PUBLIC_TYPEDEF(UT, OT) \
+#define BOOST_OPAQUE_PUBLIC_CLASS(UT, OT) \
   BOOST_OPAQUE_EXT_PUBLIC_CLASS(UT, OT, bool)
 
 //////////////////////////
 #define BOOST_OPAQUE_PRIVATE_FORWARD_CONSTRUCTORS(UT, OT) \
- OT(){}\
- template <typename W> \
- explicit OT(W w) \
- : boost::opaque::private_opaque_class<OT, UT>(w) \
- {}\
- OT(OT const& r) \
- : boost::opaque::private_opaque_class<OT, UT>(r) \
- {}
+ BOOST_OPAQUE_FORWARD_CONSTRUCTORS(OT,(boost::opaque::private_opaque_class<OT, UT>))
 
 #define BOOST_OPAQUE_PRIVATE_OPERATIONS(UT, OT) \
     BOOST_OPAQUE_PRIVATE_FORWARD_CONSTRUCTORS(UT, OT)
 
-
 //////////////////////////
 #define BOOST_OPAQUE_EXT_PRIVATE_TYPEDEF(UT, OT,B) \
 struct BOOST_JOIN(OT, _tag) {};\
@@ -95,5 +78,18 @@
 #define BOOST_OPAQUE_PRIVATE_TYPEDEF(UT, OT) \
   BOOST_OPAQUE_EXT_PRIVATE_TYPEDEF(UT, OT, bool)
 
+//////////////////////////
+#define BOOST_OPAQUE_EXT_PRIVATE_CLASS(UT, NT1, B) \
+struct NT1 : boost::opaque::private_opaque_class<NT1, UT,B> \
+{ \
+ BOOST_OPAQUE_FORWARD_CONSTRUCTORS(NT1, (boost::opaque::private_opaque_class<NT1, UT,B>)) \
+}
+
+#define BOOST_OPAQUE_BOOLEAN_PRIVATE_CLASS(UT, OT) \
+ BOOST_OPAQUE_EXT_PRIVATE_CLASS(UT, OT, boost::opaque::boolean)
+
+#define BOOST_OPAQUE_PRIVATE_CLASS(UT, OT) \
+ BOOST_OPAQUE_EXT_PRIVATE_CLASS(UT, OT, bool)
+
 #endif
 

Modified: sandbox/opaque/boost/opaque/new_class.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/new_class.hpp (original)
+++ sandbox/opaque/boost/opaque/new_class.hpp 2011-02-26 09:19:31 EST (Sat, 26 Feb 2011)
@@ -67,6 +67,7 @@
         }
 
     };
+ }
 
     template <
         typename T,
@@ -75,11 +76,11 @@
         typename MetaMixinSeq,
         typename Base
>
- T opaque_static_cast(new_class<Final, UT, MetaMixinSeq, Base> const& v)
+ T opaque_static_cast(opaque::new_class<Final, UT, MetaMixinSeq, Base> const& v)
     {
         return static_cast<T>(v.underlying());
     }
-}
+
 }
 
 

Modified: sandbox/opaque/boost/opaque/new_type.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/new_type.hpp (original)
+++ sandbox/opaque/boost/opaque/new_type.hpp 2011-02-26 09:19:31 EST (Sat, 26 Feb 2011)
@@ -40,19 +40,19 @@
         explicit new_type(T v) : base_type(v) {}
 
     };
-
+ }
     template <
- typename T,
- typename UT,
- typename Tag,
- typename MetaMixinSeq,
- typename Base
+ typename T,
+ typename UT,
+ typename Tag,
+ typename MetaMixinSeq,
+ typename Base
>
- T opaque_static_cast(new_type<UT,Tag,MetaMixinSeq,Base> const& v)
+ T opaque_static_cast(opaque::new_type<UT,Tag,MetaMixinSeq,Base> const& v)
     {
         return static_cast<T>(v.underlying());
     }
-}
+
 }
 
 


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