Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78446 - in sandbox/type_erasure: boost/type_erasure libs/type_erasure/example
From: steven_at_[hidden]
Date: 2012-05-12 22:06:32


Author: steven_watanabe
Date: 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
New Revision: 78446
URL: http://svn.boost.org/trac/boost/changeset/78446

Log:
There's no good reason for placeholder to use CRTP. Remove it.
Text files modified:
   sandbox/type_erasure/boost/type_erasure/deduced.hpp | 3 +--
   sandbox/type_erasure/boost/type_erasure/is_placeholder.hpp | 2 +-
   sandbox/type_erasure/boost/type_erasure/placeholder.hpp | 22 +++++++++-------------
   sandbox/type_erasure/libs/type_erasure/example/associated.cpp | 13 +++++++++++--
   sandbox/type_erasure/libs/type_erasure/example/print_sequence.cpp | 6 +++---
   5 files changed, 25 insertions(+), 21 deletions(-)

Modified: sandbox/type_erasure/boost/type_erasure/deduced.hpp
==============================================================================
--- sandbox/type_erasure/boost/type_erasure/deduced.hpp (original)
+++ sandbox/type_erasure/boost/type_erasure/deduced.hpp 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
@@ -31,8 +31,7 @@
  * to automatically evaluate it early as needed.
  */
 template<class Metafunction>
-struct deduced :
- ::boost::type_erasure::placeholder<deduced<Metafunction> >
+struct deduced : ::boost::type_erasure::placeholder
 {
     typedef typename ::boost::mpl::eval_if<
         ::boost::mpl::empty<

Modified: sandbox/type_erasure/boost/type_erasure/is_placeholder.hpp
==============================================================================
--- sandbox/type_erasure/boost/type_erasure/is_placeholder.hpp (original)
+++ sandbox/type_erasure/boost/type_erasure/is_placeholder.hpp 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
@@ -19,7 +19,7 @@
 
 /** A metafunction that indicates whether a type is a @ref placeholder. */
 template<class T>
-struct is_placeholder : ::boost::is_base_and_derived<placeholder_base, T> {};
+struct is_placeholder : ::boost::is_base_and_derived<placeholder, T> {};
 
 }
 }

Modified: sandbox/type_erasure/boost/type_erasure/placeholder.hpp
==============================================================================
--- sandbox/type_erasure/boost/type_erasure/placeholder.hpp (original)
+++ sandbox/type_erasure/boost/type_erasure/placeholder.hpp 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
@@ -14,9 +14,6 @@
 namespace boost {
 namespace type_erasure {
 
-/** INTERNAL ONLY */
-struct placeholder_base {};
-
 /**
  * Placeholders are used heavily throughout the library.
  * Every placeholder must derive from @ref placeholder
@@ -48,16 +45,15 @@
  * explicitly, but the substitution still works the
  * same way.
  */
-template<class Derived>
-struct placeholder : placeholder_base {};
+struct placeholder {};
 
-struct _a : placeholder<_a> {};
-struct _b : placeholder<_b> {};
-struct _c : placeholder<_c> {};
-struct _d : placeholder<_d> {};
-struct _e : placeholder<_e> {};
-struct _f : placeholder<_f> {};
-struct _g : placeholder<_g> {};
+struct _a : placeholder {};
+struct _b : placeholder {};
+struct _c : placeholder {};
+struct _d : placeholder {};
+struct _e : placeholder {};
+struct _f : placeholder {};
+struct _g : placeholder {};
 
 /**
  * \brief The default placeholder
@@ -68,7 +64,7 @@
  * explicit arguments will "just work" as much as
  * possible.
  */
-struct _self : placeholder<_self> {};
+struct _self : placeholder {};
 
 }
 }

Modified: sandbox/type_erasure/libs/type_erasure/example/associated.cpp
==============================================================================
--- sandbox/type_erasure/libs/type_erasure/example/associated.cpp (original)
+++ sandbox/type_erasure/libs/type_erasure/example/associated.cpp 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
@@ -34,14 +34,23 @@
     smart pointer as follows:
 */
 
+template<class T>
+struct pointee
+{
+ typedef typename mpl::eval_if<is_placeholder<T>,
+ mpl::identity<void>,
+ boost::pointee<T>
+ >::type type;
+};
+
 template<class T = _self>
 struct pointer :
     mpl::vector<
         copy_constructible<T>,
- dereferenceable<deduced<boost::pointee<T> >&, T>
+ dereferenceable<deduced<pointee<T> >&, T>
>
 {
- typedef deduced<boost::pointee<T> > element_type;
+ typedef deduced<pointee<T> > element_type;
 };
 
 //]

Modified: sandbox/type_erasure/libs/type_erasure/example/print_sequence.cpp
==============================================================================
--- sandbox/type_erasure/libs/type_erasure/example/print_sequence.cpp (original)
+++ sandbox/type_erasure/libs/type_erasure/example/print_sequence.cpp 2012-05-12 22:06:31 EDT (Sat, 12 May 2012)
@@ -31,9 +31,9 @@
 
 using namespace boost::type_erasure;
 
-struct _t : placeholder<_t> {};
-struct _iter : placeholder<_iter> {};
-struct _os : placeholder<_os> {};
+struct _t : placeholder {};
+struct _iter : placeholder {};
+struct _os : placeholder {};
 
 template<class T, class U = _self>
 struct base_and_derived


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