|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69299 - in sandbox/opaque/boost/opaque: . meta_mixin
From: vicente.botet_at_[hidden]
Date: 2011-02-26 05:40:56
Author: viboes
Date: 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
New Revision: 69299
URL: http://svn.boost.org/trac/boost/changeset/69299
Log:
Opaque: Add Bool parameter on opaque types
Text files modified:
sandbox/opaque/boost/opaque/macros.hpp | 56 +++++++++++++++++----------------
sandbox/opaque/boost/opaque/meta_mixin/linear_hierarchy.hpp | 2
sandbox/opaque/boost/opaque/new_type.hpp | 10 +++---
sandbox/opaque/boost/opaque/private_opaque_class.hpp | 39 ++++++-----------------
sandbox/opaque/boost/opaque/private_opaque_type.hpp | 22 +++++++------
sandbox/opaque/boost/opaque/public_opaque_class.hpp | 66 +++++----------------------------------
sandbox/opaque/boost/opaque/public_opaque_type.hpp | 18 ++++++----
7 files changed, 76 insertions(+), 137 deletions(-)
Modified: sandbox/opaque/boost/opaque/macros.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/macros.hpp (original)
+++ sandbox/opaque/boost/opaque/macros.hpp 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2010.
+// (C) Copyright Vicente J. Botet Escriba 2010-2011.
// Distributed under the Boost
// Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or
@@ -15,6 +15,7 @@
#include <boost/config.hpp>
#include <boost/opaque/private_opaque_type.hpp>
+#include <boost/opaque/boolean.hpp>
#include <boost/opaque/public_opaque_type.hpp>
#include <boost/opaque/private_opaque_class.hpp>
#include <boost/opaque/public_opaque_class.hpp>
@@ -32,28 +33,27 @@
#define BOOST_OPAQUE_PUBLIC_OPERATIONS(UT, OT) \
BOOST_OPAQUE_PUBLIC_FORWARD_CONSTRUCTORS(UT,OT)\
+//////////////////////////
+#define BOOST_OPAQUE_EXT_PUBLIC_TYPEDEF(UT, OT, B) \
+struct BOOST_JOIN(OT, _tag) {};\
+typedef boost::opaque::public_opaque_type<UT, BOOST_JOIN(OT, _tag), B> OT
+
+#define BOOST_OPAQUE_BOOLEAN_PUBLIC_TYPEDEF(UT, OT) \
+BOOST_OPAQUE_EXT_PUBLIC_TYPEDEF(UT, OT, boost::opaque::boolean)
-#if 0
-#define BOOST_OPAQUE_PUBLIC_TYPEDEF(UT, OT) \
-struct OT: boost::opaque::public_opaque_class<OT, UT> \
-{\
- BOOST_OPAQUE_PUBLIC_OPERATIONS(UT,OT);\
-}
-#else
#define BOOST_OPAQUE_PUBLIC_TYPEDEF(UT, OT) \
-struct BOOST_JOIN(OT, _tag) {};\
-typedef boost::opaque::public_opaque_type<UT, BOOST_JOIN(OT, _tag)> OT
-#endif
+BOOST_OPAQUE_EXT_PUBLIC_TYPEDEF(UT, OT, bool)
-#define BOOST_OPAQUE_PUBLIC_CLASS(UT, NT1) \
-struct NT1 : boost::opaque::public_opaque_class<NT1, UT> \
+//////////////////////////
+#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> \
+ boost::opaque::public_opaque_class<NT1, UT,B> \
base_type; \
\
NT1(){} \
- explicit NT1(unsigned v) : base_type(v) {} \
+ explicit NT1(UT v) : base_type(v) {} \
template <typename W> \
explicit NT1(W w) \
: base_type(w) \
@@ -63,8 +63,13 @@
{} \
}
- //~ template <typename T> explicit OT(T v) : boost::private_opaque_type<OT, UT>(v) {}
+#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) \
+ BOOST_OPAQUE_EXT_PUBLIC_CLASS(UT, OT, bool)
+//////////////////////////
#define BOOST_OPAQUE_PRIVATE_FORWARD_CONSTRUCTORS(UT, OT) \
OT(){}\
template <typename W> \
@@ -79,19 +84,16 @@
BOOST_OPAQUE_PRIVATE_FORWARD_CONSTRUCTORS(UT, OT)
+//////////////////////////
+#define BOOST_OPAQUE_EXT_PRIVATE_TYPEDEF(UT, OT,B) \
+struct BOOST_JOIN(OT, _tag) {};\
+typedef boost::opaque::private_opaque_type<UT, BOOST_JOIN(OT, _tag),B> OT
+#define BOOST_OPAQUE_BOOLEAN_PRIVATE_TYPEDEF(UT, OT) \
+ BOOST_OPAQUE_EXT_PRIVATE_TYPEDEF(UT, OT, boost::opaque::boolean)
-#if 0
-#define BOOST_OPAQUE_PRIVATE_TYPEDEF(UT, OT) \
-struct OT: boost::opaque::private_opaque_class<OT, UT> \
-{\
- BOOST_OPAQUE_PRIVATE_OPERATIONS(UT,OT);\
-}
-#else
#define BOOST_OPAQUE_PRIVATE_TYPEDEF(UT, OT) \
-struct BOOST_JOIN(OT, _tag) {};\
-typedef boost::opaque::private_opaque_type<UT, BOOST_JOIN(OT, _tag)> OT
-#endif
-
+ BOOST_OPAQUE_EXT_PRIVATE_TYPEDEF(UT, OT, bool)
#endif
+
Modified: sandbox/opaque/boost/opaque/meta_mixin/linear_hierarchy.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/meta_mixin/linear_hierarchy.hpp (original)
+++ sandbox/opaque/boost/opaque/meta_mixin/linear_hierarchy.hpp 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -39,7 +39,7 @@
template<typename MetaMixinSeq, typename Final, typename Base>
struct linear_hierarchy {
typedef typename boost::mpl::fold<MetaMixinSeq, Base,
- opaque_detail::inherit<Final> >::type type;
+ opaque_detail::inherit<Final> >::type type;
};
}
}
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 05:40:51 EST (Sat, 26 Feb 2011)
@@ -42,11 +42,11 @@
};
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)
{
Modified: sandbox/opaque/boost/opaque/private_opaque_class.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/private_opaque_class.hpp (original)
+++ sandbox/opaque/boost/opaque/private_opaque_class.hpp 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -13,6 +13,13 @@
#ifndef BOOST_OPAQUE_PRIVATE_OPAQUE_CLASS_HPP
#define BOOST_OPAQUE_PRIVATE_OPAQUE_CLASS_HPP
+//~ Can instances of UT be explicitly converted to instances of OT? Yes
+//~ Can instances of UT be implicitly converted to instances of OT? No
+//~ Can instances of OT be explicitly converted to instances of UT? Yes.
+//~ Waiting for explicit conversion operators, the explicit
+//~ conversion must be done through the underlying function
+//~ Can instances of OT be implicitly converted to instances of UT? No
+
#include <boost/opaque/meta_mixin/inherited_from_underlying.hpp>
#include <boost/opaque/meta_mixin/transitive_explicit_substituable.hpp>
@@ -28,61 +35,35 @@
template <
typename Final,
typename T,
+ typename Bool=bool,
typename MetaMixinSeq=boost::mpl::vector0<>,
typename Base=base_private_opaque_type
>
class private_opaque_class
: public
-#if 0
- new_class< Final, T, MetaMixinSeq,
- opaque::transitive_explicit_substituable<base_private_opaque_type,T>
- ::template type<Final,
- typename opaque::inherited_from_underlying<T>
- ::template type<Final, Base>
- >
- >
-#else
new_class< Final, T,
typename mpl::push_front<
typename mpl::push_front<
MetaMixinSeq,
opaque::transitive_explicit_substituable<base_private_opaque_type, T>
>::type,
- opaque::inherited_from_underlying<T>
+ opaque::inherited_from_underlying<T,Bool>
>::type, Base
>
-
-#endif
{
typedef
-#if 0
- new_class< Final, T, MetaMixinSeq,
- opaque::transitive_explicit_substituable<base_private_opaque_type,T>
- ::template type<Final,
- typename opaque::inherited_from_underlying<T>
- ::template type<Final, Base>
- >
- >
-#else
new_class< Final, T,
typename mpl::push_front<
typename mpl::push_front<
MetaMixinSeq,
opaque::transitive_explicit_substituable<base_private_opaque_type, T>
>::type,
- opaque::inherited_from_underlying<T>
+ opaque::inherited_from_underlying<T,Bool>
>::type, Base
>
-#endif
base_type;
public:
- //~ Can instances of UT be explicitly converted to instances of OT? Yes
- //~ Can instances of UT be implicitly converted to instances of OT? No
- //~ Can instances of OT be explicitly converted to instances of UT? Yes.
- //~ Waiting for explicit conversion operators,, the explicit
- //~ conversion must be done through the underlying function
- //~ Can instances of OT be implicitly converted to instances of UT? No
private_opaque_class() {};
private_opaque_class(const private_opaque_class & rhs)
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 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -15,31 +15,33 @@
#include <boost/opaque/private_opaque_class.hpp>
+ //~ Can instances of UT be explicitly converted to instances of OT? Yes
+ //~ Can instances of UT be implicitly converted to instances of OT? No
+ //~ Can instances of OT be explicitly converted to instances of UT? Yes.
+ //~ Waiting for explicit conversion operators,, the explicit
+ //~ conversion must be done through the underlying function
+ //~ Can instances of OT be implicitly converted to instances of UT? No
+
namespace boost {
namespace opaque {
template <
typename T,
typename Tag=void,
+ typename Bool=bool,
typename MetaMixinSeq=boost::mpl::vector0<>,
typename Base=base_private_opaque_type
>
class private_opaque_type : public
- private_opaque_class< private_opaque_type<T,Tag,MetaMixinSeq,Base>,
- T, MetaMixinSeq, Base>
+ private_opaque_class< private_opaque_type<T,Tag,Bool,MetaMixinSeq,Base>,
+ T, Bool, MetaMixinSeq, Base>
{
typedef
- private_opaque_class< private_opaque_type<T,Tag,MetaMixinSeq,Base>,
- T, MetaMixinSeq, Base>
+ private_opaque_class< private_opaque_type<T,Tag,Bool,MetaMixinSeq,Base>,
+ T, Bool, MetaMixinSeq, Base>
base_type;
public:
- //~ Can instances of UT be explicitly converted to instances of OT? Yes
- //~ Can instances of UT be implicitly converted to instances of OT? No
- //~ Can instances of OT be explicitly converted to instances of UT? Yes.
- //~ Waiting for explicit conversion operators,, the explicit
- //~ conversion must be done through the underlying function
- //~ Can instances of OT be implicitly converted to instances of UT? No
private_opaque_type() {};
private_opaque_type(const private_opaque_type & rhs)
Modified: sandbox/opaque/boost/opaque/public_opaque_class.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/public_opaque_class.hpp (original)
+++ sandbox/opaque/boost/opaque/public_opaque_class.hpp 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -13,6 +13,11 @@
#ifndef BOOST_OPAQUE_PUBLIC_OPAQUE_CLASS_HPP
#define BOOST_OPAQUE_PUBLIC_OPAQUE_CLASS_HPP
+ //~ Can instances of UT be explicitly converted to instances of OT? Yes
+ //~ Can instances of UT be implicitly converted to instances of OT? No
+ //~ Can instances of OT be explicitly converted to instances of UT? Yes
+ //~ Can instances of OT be implicitly converted to instances of UT? Yes
+
#include <boost/opaque/meta_mixin/inherited_from_underlying.hpp>
#include <boost/opaque/meta_mixin/transitive_substituable.hpp>
@@ -41,86 +46,37 @@
struct get_substituables<T,false> {
typedef mpl::vector<T> type;
};
-
-#if 0
- namespace opaque_detail {
- template <typename BaseClass, typename UT>
- struct transitive_substituable_help {
- template <typename Final, typename Base>
- struct type
- : opaque::transitive_substituable<BaseClass, UT>::template type<Final,
- typename opaque::inherited_from_underlying<UT>
- ::template type<Final, Base>
- >
- {
- operator UT() const {
- return Final::final(this).underlying();
- }
- };
- };
- }
-#endif
-
+
template <
typename Final,
typename T,
+ typename Bool=bool,
typename MetaMixinSeq=boost::mpl::vector0<>,
typename Base=base_public_opaque_type
>
class public_opaque_class
: public
-#if 0
- new_class< Final, T, MetaMixinSeq,
-#define COMPILER_WORKS
-#if !defined(COMPILER_WORKS)
- typename opaque_detail::transitive_substituable_help<base_public_opaque_type,T>
- ::template type<Final, Base>
-#else
- typename opaque::transitive_substituable<base_public_opaque_type, T>
- ::template type<Final,
- typename opaque::inherited_from_underlying<T>
- ::template type<Final, Base>
- >
-#endif
- >
-#else
new_class< Final, T,
typename mpl::push_front<
typename mpl::push_front<
MetaMixinSeq,
opaque::transitive_substituable<base_public_opaque_type, T>
>::type,
- opaque::inherited_from_underlying<T>
+ opaque::inherited_from_underlying<T,Bool>
>::type, Base
>
-#endif
{
typedef
-#if 0
- new_class< Final, T, MetaMixinSeq,
-#if !defined(COMPILER_WORKS)
- typename opaque_detail::transitive_substituable_help<base_public_opaque_type,T>
- ::template type<Final, Base>
-#else
- typename transitive_substituable<base_public_opaque_type, T>
- ::template type<Final,
- typename opaque::inherited_from_underlying<T>
- ::template type<Final, Base>
- >
-#endif
- >
-#else
new_class< Final, T,
typename mpl::push_front<
typename mpl::push_front<
MetaMixinSeq,
opaque::transitive_substituable<base_public_opaque_type, T>
>::type,
- opaque::inherited_from_underlying<T>
+ opaque::inherited_from_underlying<T,Bool>
>::type, Base
>
-#endif
base_type;
public:
@@ -130,10 +86,6 @@
>::value
>::type substituables;
- //~ Can instances of UT be explicitly converted to instances of OT? Yes
- //~ Can instances of UT be implicitly converted to instances of OT? No
- //~ Can instances of OT be explicitly converted to instances of UT? Yes
- //~ Can instances of OT be implicitly converted to instances of UT? Yes
public_opaque_class() {}
public_opaque_class(const public_opaque_class & rhs)
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 2011-02-26 05:40:51 EST (Sat, 26 Feb 2011)
@@ -13,6 +13,11 @@
#ifndef BOOST_OPAQUE_PUBLIC_OPAQUE_TYPE_HPP
#define BOOST_OPAQUE_PUBLIC_OPAQUE_TYPE_HPP
+ //~ Can instances of UT be explicitly converted to instances of OT? Yes
+ //~ Can instances of UT be implicitly converted to instances of OT? No
+ //~ Can instances of OT be explicitly converted to instances of UT? Yes
+ //~ Can instances of OT be implicitly converted to instances of UT? Yes
+
#include <boost/opaque/public_opaque_class.hpp>
namespace boost {
@@ -21,23 +26,20 @@
template <
typename T,
typename Tag=void,
+ typename Bool=bool,
typename MetaMixinSeq=boost::mpl::vector0<>,
typename Base=base_public_opaque_type
>
class public_opaque_type
: public
- public_opaque_class< public_opaque_type<T,Tag,MetaMixinSeq,Base>,
- T, MetaMixinSeq, Base>
+ public_opaque_class< public_opaque_type<T,Tag,Bool,MetaMixinSeq,Base>,
+ T, Bool, MetaMixinSeq, Base>
{
typedef
- public_opaque_class< public_opaque_type<T,Tag,MetaMixinSeq,Base>,
- T, MetaMixinSeq, Base> base_type;
+ public_opaque_class< public_opaque_type<T,Tag,Bool,MetaMixinSeq,Base>,
+ T, Bool, MetaMixinSeq, Base> base_type;
public:
- //~ Can instances of UT be explicitly converted to instances of OT? Yes
- //~ Can instances of UT be implicitly converted to instances of OT? No
- //~ Can instances of OT be explicitly converted to instances of UT? Yes
- //~ Can instances of OT be implicitly converted to instances of UT? Yes
public_opaque_type() {}
public_opaque_type(const public_opaque_type & rhs)
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