Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65722 - sandbox/opaque/boost/opaque
From: vicente.botet_at_[hidden]
Date: 2010-10-02 08:25:37


Author: viboes
Date: 2010-10-02 08:25:35 EDT (Sat, 02 Oct 2010)
New Revision: 65722
URL: http://svn.boost.org/trac/boost/changeset/65722

Log:
Opaque:
* Add linerar_hierarchy class

Added:
   sandbox/opaque/boost/opaque/linear_hierarchy.hpp (contents, props changed)
Text files modified:
   sandbox/opaque/boost/opaque/new_class.hpp | 30 +++++-------------------------
   sandbox/opaque/boost/opaque/operators.hpp | 1 -
   sandbox/opaque/boost/opaque/private_opaque_class.hpp | 4 ++--
   3 files changed, 7 insertions(+), 28 deletions(-)

Added: sandbox/opaque/boost/opaque/linear_hierarchy.hpp
==============================================================================
--- (empty file)
+++ sandbox/opaque/boost/opaque/linear_hierarchy.hpp 2010-10-02 08:25:35 EDT (Sat, 02 Oct 2010)
@@ -0,0 +1,46 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/opaque for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_OPAQUE_LINEAR_HIERARCHY_HPP
+#define BOOST_OPAQUE_LINEAR_HIERARCHY_HPP
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/fold.hpp>
+
+namespace boost {
+
+ ////// implementation //////
+ namespace detail{
+
+ template<typename Final, typename UT, typename State, typename MetaMixin>
+ struct do_inhetit : MetaMixin::template type< Final, UT, State> {
+ };
+
+ template<typename Final, typename UT>
+ struct inherit {
+ template<typename State, typename MetaMixin>
+ struct apply{
+ typedef do_inhetit< Final, UT, State, MetaMixin> type;
+ };
+ };
+
+ }
+
+ template<typename MetaMixinSeq, typename Final, typename UT, typename Base>
+ struct linear_hierarchy {
+ typedef typename boost::mpl::fold<MetaMixinSeq, Base, detail::inherit<Final, UT> >::type type;
+ };
+
+}
+
+
+#endif

Modified: sandbox/opaque/boost/opaque/new_class.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/new_class.hpp (original)
+++ sandbox/opaque/boost/opaque/new_class.hpp 2010-10-02 08:25:35 EDT (Sat, 02 Oct 2010)
@@ -13,34 +13,14 @@
 #ifndef BOOST_OPAQUE_NEW_CLASS_HPP
 #define BOOST_OPAQUE_NEW_CLASS_HPP
 
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/fold.hpp>
+#include <boost/opaque/linear_hierarchy.hpp>
 
 namespace boost {
 
     class base_new_type {};
 
- ////// implementation //////
- namespace detail{
-
- template<typename NT, typename UT, typename State, typename Concept>
- struct do_inhetit : Concept::template type<NT, UT, State> {
- };
-
- template<typename NT, typename UT>
- struct inherit {
- template<typename State, typename Concept>
- struct apply{
- typedef do_inhetit<NT, UT, State, Concept> type;
- };
- };
-
- }
-
- template <typename Final, typename T, typename Concepts=boost::mpl::vector0<>, typename Base=base_new_type >
- class new_class : public
- //~ Base
- boost::mpl::fold<Concepts, Base, detail::inherit<Final, T> >::type
+ template <typename Final, typename T, typename MetaMixinSeq=boost::mpl::vector0<>, typename Base=base_new_type >
+ class new_class : public linear_hierarchy<MetaMixinSeq, Final, T, Base>::type
     {
     public:
         typedef T underlying_type;
@@ -85,8 +65,8 @@
 
     };
 
- template <typename T, typename Final, typename UT, typename Concepts, typename Base >
- T opaque_static_cast(new_class<Final, UT, Concepts, Base> const& v)
+ template <typename T, typename Final, typename UT, typename MetaMixinSeq, typename Base >
+ T opaque_static_cast(new_class<Final, UT, MetaMixinSeq, Base> const& v)
     {
         return static_cast<T>(v.underlying());
     }

Modified: sandbox/opaque/boost/opaque/operators.hpp
==============================================================================
--- sandbox/opaque/boost/opaque/operators.hpp (original)
+++ sandbox/opaque/boost/opaque/operators.hpp 2010-10-02 08:25:35 EDT (Sat, 02 Oct 2010)
@@ -560,7 +560,6 @@
             return Final(Final::underlying(this) >> rhs.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-02 08:25:35 EDT (Sat, 02 Oct 2010)
@@ -26,14 +26,14 @@
     template <typename Final, typename T, typename Concepts=boost::mpl::vector0<>, typename Base=base_private_opaque_type>
     class private_opaque_class : public
             new_class< Final, T, Concepts,
- transitive_explicit_substituable<base_private_opaque_type>::template type<Final, T,
+ transitive_explicit_substituable<base_private_opaque_type>::template type<Final, T,
                     typename inherited_from_undelying<T>::template type<Final, T, Base>
>
>
     {
         typedef
             new_class< Final, T, Concepts,
- transitive_explicit_substituable<base_private_opaque_type>::template type<Final, T,
+ transitive_explicit_substituable<base_private_opaque_type>::template type<Final, T,
                     typename inherited_from_undelying<T>::template type<Final, T, Base>
>
>


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