|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65732 - in sandbox/opaque/boost/opaque: . meta_mixin
From: vicente.botet_at_[hidden]
Date: 2010-10-03 04:44:43
Author: viboes
Date: 2010-10-03 04:44:38 EDT (Sun, 03 Oct 2010)
New Revision: 65732
URL: http://svn.boost.org/trac/boost/changeset/65732
Log:
Opaque:
* use push_back on MetaMixins instead of inheritance
Text files modified:
sandbox/opaque/boost/opaque/meta_mixin/transitive_explicit_substituable.hpp | 34 ++++++++++++++++++++++++----------
sandbox/opaque/boost/opaque/meta_mixin/transitive_substituable.hpp | 29 +++++++++++++++++++++++------
sandbox/opaque/boost/opaque/private_opaque_class.hpp | 40 +++++++++++++++++++++++++++++++++-------
sandbox/opaque/boost/opaque/public_opaque_class.hpp | 25 +++++++++++++++++++++++++
4 files changed, 105 insertions(+), 23 deletions(-)
Modified: sandbox/opaque/boost/opaque/meta_mixin/transitive_explicit_substituable.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/meta_mixin/transitive_explicit_substituable.hpp (original)
+++ sandbox/opaque/boost/opaque/meta_mixin/transitive_explicit_substituable.hpp 2010-10-03 04:44:38 EDT (Sun, 03 Oct 2010)
@@ -21,21 +21,34 @@
namespace boost {
-
- template <typename BaseClass>
+ template <typename BaseClass, typename UT>
struct transitive_explicit_substituable;
namespace detail {
- template <typename BaseClass, typename Final, typename UT, typename Base, bool B>
+ template <
+ typename BaseClass,
+ typename Final,
+ typename UT,
+ typename Base,
+ bool B>
struct transitive_explicit_substituable_next_level;
- template <typename BaseClass, typename Final, typename UT, typename Base>
+ template <
+ typename BaseClass,
+ typename Final,
+ typename UT,
+ typename Base>
struct transitive_explicit_substituable_next_level<BaseClass, Final, UT, Base, true>
- : transitive_explicit_substituable<BaseClass>::template
- type<Final, typename UT::underlying_type, Base>
+ : transitive_explicit_substituable<BaseClass, typename UT::underlying_type>
+ ::template type<Final, Base>
{};
- template <typename BaseClass, typename Final, typename UT, typename Base>
+ template <
+ typename BaseClass,
+ typename Final,
+ typename UT,
+ typename Base
+ >
struct transitive_explicit_substituable_next_level<BaseClass, Final, UT, Base, false>
: Base
{};
@@ -46,15 +59,16 @@
template <typename T> struct type_tag : public base_tag<T> {};
}
- template <typename BaseClass>
+ template <typename BaseClass, typename UT>
struct transitive_explicit_substituable {
- template <typename Final, typename UT, typename Base>
+ template <typename Final, typename Base>
struct type
: detail::transitive_explicit_substituable_next_level<BaseClass, Final, UT, Base,
mpl::and_<is_class<UT>, is_base_of<BaseClass, UT> >::value>
{
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
- friend UT convert_to(Final const& rhs, boost::dummy::type_tag<UT> const&)
+ friend UT convert_to(Final const& rhs,
+ boost::dummy::type_tag<UT> const&)
{
return Final::final(&rhs).underlying();
}
Modified: sandbox/opaque/boost/opaque/meta_mixin/transitive_substituable.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/meta_mixin/transitive_substituable.hpp (original)
+++ sandbox/opaque/boost/opaque/meta_mixin/transitive_substituable.hpp 2010-10-03 04:44:38 EDT (Sun, 03 Oct 2010)
@@ -24,15 +24,30 @@
namespace detail {
- template <typename BaseClass, typename Final, typename UT, typename Base, bool IsConvertible>
+ template <
+ typename BaseClass,
+ typename Final,
+ typename UT,
+ typename Base,
+ bool IsConvertible
+ >
struct transitive_substituable_next_level;
- template <typename BaseClass, typename Final, typename UT, typename Base>
+ template <
+ typename BaseClass,
+ typename Final,
+ typename UT,
+ typename Base
+ >
struct transitive_substituable_next_level<BaseClass, Final, UT, Base, true>
- : transitive_substituable<BaseClass, typename UT::underlying_type>::template type<Final, Base> { };
+ : transitive_substituable<BaseClass, typename UT::underlying_type>
+ ::template type<Final, Base>
+ { };
template <typename BaseClass, typename Final, typename UT, typename Base>
- struct transitive_substituable_next_level<BaseClass, Final, UT, Base, false> : Base { };
+ struct transitive_substituable_next_level<BaseClass, Final, UT, Base, false>
+ : Base
+ { };
}
@@ -40,8 +55,10 @@
struct transitive_substituable {
template <typename Final, typename Base>
struct type
- : detail::transitive_substituable_next_level<BaseClass, Final, UT, Base,
- mpl::and_<is_class<UT>, is_base_of<BaseClass, UT> >::value>
+ : detail::transitive_substituable_next_level<
+ BaseClass, Final, UT, Base,
+ mpl::and_<is_class<UT>, is_base_of<BaseClass, UT>
+ >::value>
{
operator UT() const {
return Final::final(this).underlying();
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 2010-10-03 04:44:38 EDT (Sun, 03 Oct 2010)
@@ -19,6 +19,7 @@
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/mpl/and.hpp>
+#include <boost/mpl/push_back.hpp>
namespace boost {
class base_private_opaque_type {};
@@ -30,23 +31,48 @@
typename Base=base_private_opaque_type
>
class private_opaque_class
- : public
+ : public
+#if 0
new_class< Final, T, MetaMixinSeq,
- transitive_explicit_substituable<base_private_opaque_type>
- ::template type<Final, T,
+ 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_back<
+ typename mpl::push_back<
+ MetaMixinSeq,
+ transitive_explicit_substituable<base_private_opaque_type, T>
+ >::type,
+ opaque::inherited_from_underlying<T>
+ >::type, Base
+ >
+
+#endif
{
typedef
- new_class< Final, T, MetaMixinSeq,
- transitive_explicit_substituable<base_private_opaque_type>
- ::template type<Final, T,
+#if 0
+ new_class< Final, T, MetaMixinSeq,
+ transitive_explicit_substituable<base_private_opaque_type,T>
+ ::template type<Final,
typename opaque::inherited_from_underlying<T>
- ::template type<Final, Base>
+ ::template type<Final, Base>
>
>
+#else
+ new_class< Final, T,
+ typename mpl::push_back<
+ typename mpl::push_back<
+ MetaMixinSeq,
+ transitive_explicit_substituable<base_private_opaque_type, T>
+ >::type,
+ opaque::inherited_from_underlying<T>
+ >::type, Base
+ >
+#endif
base_type;
public:
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 2010-10-03 04:44:38 EDT (Sun, 03 Oct 2010)
@@ -21,6 +21,7 @@
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/vector.hpp>
+#include <boost/mpl/push_back.hpp>
namespace boost {
@@ -63,6 +64,7 @@
>
class public_opaque_class
: public
+#if 0
new_class< Final, T, MetaMixinSeq,
#define COMPILER_WORKS
#if !defined(COMPILER_WORKS)
@@ -76,9 +78,21 @@
>
#endif
>
+#else
+ new_class< Final, T,
+ typename mpl::push_back<
+ typename mpl::push_back<
+ MetaMixinSeq,
+ transitive_substituable<base_public_opaque_type, T>
+ >::type,
+ opaque::inherited_from_underlying<T>
+ >::type, Base
+ >
+#endif
{
typedef
+#if 0
new_class< Final, T, MetaMixinSeq,
#if !defined(COMPILER_WORKS)
typename transitive_substituable_help<base_public_opaque_type,T>
@@ -91,6 +105,17 @@
>
#endif
>
+#else
+ new_class< Final, T,
+ typename mpl::push_back<
+ typename mpl::push_back<
+ MetaMixinSeq,
+ transitive_substituable<base_public_opaque_type, T>
+ >::type,
+ opaque::inherited_from_underlying<T>
+ >::type, Base
+ >
+#endif
base_type;
public:
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