From 57c0ad44f399cf3d6e60c0d682a5408ba9600c45 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 23 Oct 2002 13:55:18 +0000 Subject: [PATCH] Changed typename to class; some libraries helpfully #define typename [SVN r15970] --- include/boost/detail/shared_count.hpp | 2 +- include/boost/scoped_array.hpp | 2 +- include/boost/scoped_ptr.hpp | 6 +-- include/boost/shared_array.hpp | 14 ++--- include/boost/shared_ptr.hpp | 58 ++++++++++---------- include/boost/weak_ptr.hpp | 16 +++--- scoped_array.htm | 6 +-- scoped_ptr.htm | 6 +-- shared_array.htm | 26 ++++----- shared_ptr.htm | 76 +++++++++++++-------------- smart_ptr_test.cpp | 2 +- weak_ptr.htm | 38 +++++++------- 12 files changed, 126 insertions(+), 126 deletions(-) diff --git a/include/boost/detail/shared_count.hpp b/include/boost/detail/shared_count.hpp index b47fe62..dd6ba2d 100644 --- a/include/boost/detail/shared_count.hpp +++ b/include/boost/detail/shared_count.hpp @@ -309,7 +309,7 @@ public: // auto_ptr is special cased to provide the strong guarantee - template + template explicit shared_count(std::auto_ptr & r): pi_(new counted_base_impl< Y *, checked_deleter >(r.get(), checked_deleter(), 1, 1)) { r.release(); diff --git a/include/boost/scoped_array.hpp b/include/boost/scoped_array.hpp index 8c7fdcc..636fad4 100644 --- a/include/boost/scoped_array.hpp +++ b/include/boost/scoped_array.hpp @@ -24,7 +24,7 @@ namespace boost // is guaranteed, either on destruction of the scoped_array or via an explicit // reset(). Use shared_array or std::vector if your needs are more complex. -template class scoped_array // noncopyable +template class scoped_array // noncopyable { private: diff --git a/include/boost/scoped_ptr.hpp b/include/boost/scoped_ptr.hpp index 589bd36..1c2a520 100644 --- a/include/boost/scoped_ptr.hpp +++ b/include/boost/scoped_ptr.hpp @@ -27,7 +27,7 @@ namespace boost // an explicit reset(). scoped_ptr is a simple solution for simple needs; // use shared_ptr or std::auto_ptr if your needs are more complex. -template class scoped_ptr // noncopyable +template class scoped_ptr // noncopyable { private: @@ -106,14 +106,14 @@ public: } }; -template inline void swap(scoped_ptr & a, scoped_ptr & b) // never throws +template inline void swap(scoped_ptr & a, scoped_ptr & b) // never throws { a.swap(b); } // get_pointer(p) is a generic way to say p.get() -template inline T * get_pointer(scoped_ptr const & p) +template inline T * get_pointer(scoped_ptr const & p) { return p.get(); } diff --git a/include/boost/shared_array.hpp b/include/boost/shared_array.hpp index c60a85a..992bdee 100644 --- a/include/boost/shared_array.hpp +++ b/include/boost/shared_array.hpp @@ -41,7 +41,7 @@ namespace boost // is destroyed or reset. // -template class shared_array +template class shared_array { private: @@ -63,7 +63,7 @@ public: // shared_array will release p by calling d(p) // - template shared_array(T * p, D d): px(p), pn(p, d) + template shared_array(T * p, D d): px(p), pn(p, d) { } @@ -75,7 +75,7 @@ public: this_type(p).swap(*this); } - template void reset(T * p, D d) + template void reset(T * p, D d) { this_type(p, d).swap(*this); } @@ -129,22 +129,22 @@ private: }; // shared_array -template inline bool operator==(shared_array const & a, shared_array const & b) // never throws +template inline bool operator==(shared_array const & a, shared_array const & b) // never throws { return a.get() == b.get(); } -template inline bool operator!=(shared_array const & a, shared_array const & b) // never throws +template inline bool operator!=(shared_array const & a, shared_array const & b) // never throws { return a.get() != b.get(); } -template inline bool operator<(shared_array const & a, shared_array const & b) // never throws +template inline bool operator<(shared_array const & a, shared_array const & b) // never throws { return std::less()(a.get(), b.get()); } -template void swap(shared_array & a, shared_array & b) // never throws +template void swap(shared_array & a, shared_array & b) // never throws { a.swap(b); } diff --git a/include/boost/shared_ptr.hpp b/include/boost/shared_ptr.hpp index 8f55948..11202f4 100644 --- a/include/boost/shared_ptr.hpp +++ b/include/boost/shared_ptr.hpp @@ -46,7 +46,7 @@ struct static_cast_tag {}; struct dynamic_cast_tag {}; struct polymorphic_cast_tag {}; -template struct shared_ptr_traits +template struct shared_ptr_traits { typedef T & reference; }; @@ -76,10 +76,10 @@ template<> struct shared_ptr_traits // is destroyed or reset. // -template class weak_ptr; -template class intrusive_ptr; +template class weak_ptr; +template class intrusive_ptr; -template class shared_ptr +template class shared_ptr { private: @@ -96,7 +96,7 @@ public: { } - template + template explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter(), p) // Y must be complete { } @@ -107,33 +107,33 @@ public: // shared_ptr will release p by calling d(p) // - template shared_ptr(Y * p, D d): px(p), pn(p, d) + template shared_ptr(Y * p, D d): px(p), pn(p, d) { } // generated copy constructor, assignment, destructor are fine - template + template explicit shared_ptr(weak_ptr const & r): px(r.px), pn(r.pn) // may throw { } - template + template shared_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws { } - template + template shared_ptr(intrusive_ptr const & r): px(r.get()), pn(r.get()) // never throws { } - template + template shared_ptr(shared_ptr const & r, detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) { } - template + template shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if (px == 0) // need to allocate new counter -- the cast failed @@ -142,7 +142,7 @@ public: } } - template + template shared_ptr(shared_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if (px == 0) @@ -153,7 +153,7 @@ public: #ifndef BOOST_NO_AUTO_PTR - template + template explicit shared_ptr(std::auto_ptr & r): px(r.get()), pn(r) { } @@ -162,7 +162,7 @@ public: #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) - template + template shared_ptr & operator=(shared_ptr const & r) // never throws { px = r.px; @@ -174,7 +174,7 @@ public: #ifndef BOOST_NO_AUTO_PTR - template + template shared_ptr & operator=(std::auto_ptr & r) { this_type(r).swap(*this); @@ -188,13 +188,13 @@ public: this_type().swap(*this); } - template void reset(Y * p) // Y must be complete + template void reset(Y * p) // Y must be complete { BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors this_type(p).swap(*this); } - template void reset(Y * p, D d) + template void reset(Y * p, D d) { this_type(p, d).swap(*this); } @@ -253,8 +253,8 @@ public: private: - template friend class shared_ptr; - template friend class weak_ptr; + template friend class shared_ptr; + template friend class weak_ptr; #endif @@ -264,12 +264,12 @@ private: }; // shared_ptr -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) { return a.get() == b.get(); } -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) { return a.get() != b.get(); } @@ -278,39 +278,39 @@ template inline bool operator!=(shared_ptr const & a, // Resolve the ambiguity between our op!= and the one in rel_ops -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) { return a.get() != b.get(); } #endif -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) { return std::less()(a.get(), b.get()); } -template inline void swap(shared_ptr & a, shared_ptr & b) +template inline void swap(shared_ptr & a, shared_ptr & b) { a.swap(b); } -template shared_ptr shared_static_cast(shared_ptr const & r) +template shared_ptr shared_static_cast(shared_ptr const & r) { return shared_ptr(r, detail::static_cast_tag()); } -template shared_ptr shared_dynamic_cast(shared_ptr const & r) +template shared_ptr shared_dynamic_cast(shared_ptr const & r) { return shared_ptr(r, detail::dynamic_cast_tag()); } -template shared_ptr shared_polymorphic_cast(shared_ptr const & r) +template shared_ptr shared_polymorphic_cast(shared_ptr const & r) { return shared_ptr(r, detail::polymorphic_cast_tag()); } -template shared_ptr shared_polymorphic_downcast(shared_ptr const & r) +template shared_ptr shared_polymorphic_downcast(shared_ptr const & r) { BOOST_ASSERT(dynamic_cast(r.get()) == r.get()); return shared_static_cast(r); @@ -318,7 +318,7 @@ template shared_ptr shared_polymorphic_downcast(share // get_pointer() enables boost::mem_fn to recognize shared_ptr -template inline T * get_pointer(shared_ptr const & p) +template inline T * get_pointer(shared_ptr const & p) { return p.get(); } diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index c76cb28..e17a9f7 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -24,7 +24,7 @@ namespace boost { -template class weak_ptr +template class weak_ptr { private: @@ -41,19 +41,19 @@ public: // generated copy constructor, assignment, destructor are fine - template + template weak_ptr(weak_ptr const & r): px(r.px), pn(r.pn) // never throws { } - template + template weak_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws { } #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) - template + template weak_ptr & operator=(weak_ptr const & r) // never throws { px = r.px; @@ -61,7 +61,7 @@ public: return *this; } - template + template weak_ptr & operator=(shared_ptr const & r) // never throws { px = r.px; @@ -109,8 +109,8 @@ public: private: - template friend class weak_ptr; - template friend class shared_ptr; + template friend class weak_ptr; + template friend class shared_ptr; #endif @@ -133,7 +133,7 @@ template inline bool operator!=(weak_ptr const & a, weak_pt // Resolve the ambiguity between our op!= and the one in rel_ops -template inline bool operator!=(weak_ptr const & a, weak_ptr const & b) +template inline bool operator!=(weak_ptr const & a, weak_ptr const & b) { return a.get() != b.get(); } diff --git a/scoped_array.htm b/scoped_array.htm index 834e0d2..a057b11 100644 --- a/scoped_array.htm +++ b/scoped_array.htm @@ -34,7 +34,7 @@

Synopsis

namespace boost {
 
-  template<typename T> class scoped_array : noncopyable {
+  template<class T> class scoped_array : noncopyable {
 
     public:
       typedef T element_type;
@@ -50,7 +50,7 @@
       void swap(scoped_array & b); // never throws
   };
 
-  template<typename T> void swap(scoped_array<T> & a, scoped_array<T> & b); // never throws
+  template<class T> void swap(scoped_array<T> & a, scoped_array<T> & b); // never throws
 
 }

Members

@@ -96,7 +96,7 @@ requirements.

Free Functions

swap

-
template<typename T> void swap(scoped_array<T> & a, scoped_array<T> & b); // never throws
+
template<class T> void swap(scoped_array<T> & a, scoped_array<T> & b); // never throws

Equivalent to a.swap(b). Matches the interface of std::swap. Provided as an aid to generic programming.


diff --git a/scoped_ptr.htm b/scoped_ptr.htm index d684b6b..53815c7 100644 --- a/scoped_ptr.htm +++ b/scoped_ptr.htm @@ -34,7 +34,7 @@

Synopsis

namespace boost {
 
-  template<typename T> class scoped_ptr : noncopyable {
+  template<class T> class scoped_ptr : noncopyable {
 
    public:
      typedef T element_type;
@@ -51,7 +51,7 @@
      void swap(scoped_ptr & b); // never throws
   };
 
-  template<typename T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b); // never throws
+  template<class T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b); // never throws
 
 }

Members

@@ -97,7 +97,7 @@ requirements.

Free Functions

swap

-
template<typename T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b); // never throws
+
template<class T> void swap(scoped_ptr<T> & a, scoped_ptr<T> & b); // never throws

Equivalent to a.swap(b). Matches the interface of std::swap. Provided as an aid to generic programming.

Example

diff --git a/shared_array.htm b/shared_array.htm index 52c58e6..26a6dab 100644 --- a/shared_array.htm +++ b/shared_array.htm @@ -31,13 +31,13 @@

Synopsis

namespace boost {
 
-  template<typename T> class shared_array {
+  template<class T> class shared_array {
 
     public:
       typedef T element_type;
 
       explicit shared_array(T * p = 0);
-      template<typename D> shared_array(T * p, D d);
+      template<class D> shared_array(T * p, D d);
       ~shared_array(); // never throws
 
       shared_array(shared_array const & r); // never throws
@@ -45,7 +45,7 @@
       shared_array & operator=(shared_array const & r); // never throws
 
       void reset(T * p = 0);
-      template<typename D> void reset(T * p, D d);
+      template<class D> void reset(T * p, D d);
 
       T & operator[](std::ptrdiff_t i) const() const; // never throws
       T * get() const; // never throws
@@ -56,14 +56,14 @@
       void swap(shared_array<T> & b); // never throws
   };
 
-  template<typename T>
+  template<class T>
     bool operator==(shared_array<T> const & a, shared_array<T> const & b); // never throws
-  template<typename T>
+  template<class T>
     bool operator!=(shared_array<T> const & a, shared_array<T> const & b); // never throws
-  template<typename T>
+  template<class T>
     bool operator<(shared_array<T> const & a, shared_array<T> const & b); // never throws
 
-  template<typename T> void swap(shared_array<T> & a, shared_array<T> & b); // never throws
+  template<class T> void swap(shared_array<T> & a, shared_array<T> & b); // never throws
 
 }

Members

@@ -78,7 +78,7 @@ ~shared_array). The only exception which may be thrown by this constructor is std::bad_alloc. If an exception is thrown, delete[] p is called.

-
template<typename D> shared_array(T * p, D d);
+
template<class D> shared_array(T * p, D d);

Constructs a shared_array, storing a copy of p and of d. Afterwards, the use count is 1. D's copy constructor and destructor must not throw. When the the time comes to delete @@ -109,7 +109,7 @@ then replaces this shared_array with the new one, destroying the replaced object. The only exception which may be thrown is std::bad_alloc. If an exception is thrown, delete[] p is called.

-
template<typename D> void reset(T * p, D d);
+
template<class D> void reset(T * p, D d);

Constructs a new shared_array as described above, then replaces this shared_array with the new one, destroying the replaced object. D's copy constructor must not throw. The only exception @@ -146,11 +146,11 @@ requirements.

Free Functions

comparison

-
template<typename T>
+		
template<class T>
   bool operator==(shared_array<T> const & a, shared_array<T> const & b); // never throws
-template<typename T>
+template<class T>
   bool operator!=(shared_array<T> const & a, shared_array<T> const & b); // never throws
-template<typename T>
+template<class T>
   bool operator<(shared_array<T> const & a, shared_array<T> const & b); // never throws

Compares the stored pointers of the two smart pointers. T need not be a complete type. See the smart pointer common @@ -163,7 +163,7 @@ template<typename T> paragraph 2) but std::less<> on pointers is well-defined (20.3.3 [lib.comparisons] paragraph 8).

swap

-
template<typename T>
+		
template<class T>
   void swap(shared_array<T> & a, shared_array<T> & b) // never throws

Equivalent to a.swap(b). Matches the interface of std::swap. Provided as an aid to generic programming.

diff --git a/shared_ptr.htm b/shared_ptr.htm index 87a29b0..f1ca5b2 100644 --- a/shared_ptr.htm +++ b/shared_ptr.htm @@ -88,31 +88,31 @@ void bad() class use_count_is_zero: public std::exception; - template<typename T> class weak_ptr; + template<class T> class weak_ptr; - template<typename T> class shared_ptr { + template<class T> class shared_ptr { public: typedef T element_type; shared_ptr(); - template<typename Y> explicit shared_ptr(Y * p); - template<typename Y, typename D> shared_ptr(Y * p, D d); + template<class Y> explicit shared_ptr(Y * p); + template<class Y, class D> shared_ptr(Y * p, D d); ~shared_ptr(); // never throws shared_ptr(shared_ptr const & r); // never throws - template<typename Y> shared_ptr(shared_ptr<Y> const & r); // never throws - template<typename Y> explicit shared_ptr(weak_ptr<Y> const & r); - template<typename Y> explicit shared_ptr(std::auto_ptr<Y> & r); + template<class Y> shared_ptr(shared_ptr<Y> const & r); // never throws + template<class Y> explicit shared_ptr(weak_ptr<Y> const & r); + template<class Y> explicit shared_ptr(std::auto_ptr<Y> & r); shared_ptr & operator=(shared_ptr const & r); // never throws - template<typename Y> shared_ptr & operator=(shared_ptr<Y> const & r); // never throws - template<typename Y> shared_ptr & operator=(std::auto_ptr<Y> & r); + template<class Y> shared_ptr & operator=(shared_ptr<Y> const & r); // never throws + template<class Y> shared_ptr & operator=(std::auto_ptr<Y> & r); void reset(); - template<typename Y> void reset(Y * p); - template<typename Y, typename D> void reset(Y * p, D d); + template<class Y> void reset(Y * p); + template<class Y, class D> void reset(Y * p, D d); T & operator*() const; // never throws T * operator->() const; // never throws @@ -126,24 +126,24 @@ void bad() void swap(shared_ptr & b); // never throws }; - template<typename T, typename U> + template<class T, class U> bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b); // never throws - template<typename T, typename U> + template<class T, class U> bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b); // never throws - template<typename T> + template<class T> bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b); // never throws - template<typename T> void swap(shared_ptr<T> & a, shared_ptr<T> & b); // never throws + template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b); // never throws - template<typename T> T * get_pointer(shared_ptr<T> const & p); // never throws + template<class T> T * get_pointer(shared_ptr<T> const & p); // never throws - template<typename T, typename U> + template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r); // never throws - template<typename T, typename U> + template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r); - template<typename T, typename U> + template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r); - template<typename T, typename U> + template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r); // never throws }
@@ -188,7 +188,7 @@ void bad() literal zero, for consistency with built-in pointers. It is not clear yet whether this constructor should be left implicit, enabling 0 to be used as a shorthand for shared_ptr<T>().]

-
template<typename Y> explicit shared_ptr(Y * p);
+
template<class Y> explicit shared_ptr(Y * p);

Requirements: p must be convertible to T *. Y must be a complete type. The expression delete p must be @@ -230,7 +230,7 @@ void bad() specification should allow both; nevertheless, the ability to make a shared_ptr from this is considered essential by experienced smart pointer users.]

-
template<typename Y, typename D> shared_ptr(Y * p, D d);
+
template<class Y, class D> shared_ptr(Y * p, D d);

Requirements: p must be convertible to T *. D must be CopyConstructible. The copy constructor and destructor @@ -265,7 +265,7 @@ void bad() all.)

The requrement will be removed when the aforementioned issues are resolved.]

shared_ptr(shared_ptr const & r); // never throws
-template<typename Y> shared_ptr(shared_ptr<Y> const & r); // never throws
+template<class Y> shared_ptr(shared_ptr<Y> const & r); // never throws

Effects: Constructs a shared_ptr, as if by storing a copy of the pointer stored in r.

@@ -275,7 +275,7 @@ template<typename Y> shared_ptr(shared_ptr<Y> const & r); // nev

[The postcondition will be relaxed when a default-constructed shared_ptr is being copied.]

-
template<typename Y> explicit shared_ptr(weak_ptr<Y> const & r);
+
template<class Y> explicit shared_ptr(weak_ptr<Y> const & r);

Effects: Constructs a shared_ptr, as if by storing a copy of the pointer stored in r.

@@ -296,7 +296,7 @@ template<typename Y> shared_ptr(shared_ptr<Y> const & r); // nev interface is non-trivial.

My opinion is that the added functionality is worth the cost. weak_ptr is provided in the reference implementation as a proof of concept.]

-
template<typename Y> shared_ptr(std::auto_ptr<Y> & r);
+
template<class Y> shared_ptr(std::auto_ptr<Y> & r);

Effects: Constructs a shared_ptr, as if by storing a copy of r.release().

Postconditions: use count is 1.

@@ -318,8 +318,8 @@ template<typename Y> shared_ptr(shared_ptr<Y> const & r); // nev

assignment

shared_ptr & operator=(shared_ptr const & r); // never throws
-template<typename Y> shared_ptr & operator=(shared_ptr<Y> const & r); // never throws
-template<typename Y> shared_ptr & operator=(std::auto_ptr<Y> & r);
+template<class Y> shared_ptr & operator=(shared_ptr<Y> const & r); // never throws +template<class Y> shared_ptr & operator=(std::auto_ptr<Y> & r);

Effects: Equivalent to shared_ptr(r).swap(*this).

Notes: The use count updates caused by the temporary object construction @@ -347,11 +347,11 @@ q = p;

[reset() will offer the nothrow guarantee in a future implementation.]

-
template<typename Y> void reset(Y * p);
+
template<class Y> void reset(Y * p);

Effects: Equivalent to shared_ptr(p).swap(*this).

-
template<typename Y, typename D> void reset(Y * p, D d);
+
template<class Y, class D> void reset(Y * p, D d);

Effects: Equivalent to shared_ptr(p, d).swap(*this).

@@ -416,19 +416,19 @@ q = p;

Free Functions

comparison

-
template<typename T, typename U>
+		
template<class T, class U>
   bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b); // never throws

Returns: a.get() == b.get().

Throws: nothing.

-
template<typename T, typename U>
+		
template<class T, class U>
   bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b); // never throws

Returns: a.get() != b.get().

Throws: nothing.

-
template<typename T>
+		
template<class T>
   bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b); // never throws

Returns: an unspecified value such that operator< is a strict @@ -447,7 +447,7 @@ q = p; subobjects' operator<.

The rest of the comparison operators are omitted by design.]

swap

-
template<typename T>
+		
template<class T>
   void swap(shared_ptr<T> & a, shared_ptr<T> & b); // never throws

Effects: Equivalent to a.swap(b).

@@ -459,7 +459,7 @@ q = p; as this is currently the only legal way to supply a swap function that has a chance to be used by the standard library.]

get_pointer

-
template<typename T>
+		
template<class T>
   T * get_pointer(shared_ptr<T> const & p); // never throws

Returns: p.get().

@@ -468,7 +468,7 @@ q = p; mem_fn.

shared_static_cast

-
template<typename T, typename U>
+		
template<class T, class U>
   shared_ptr<T> shared_static_cast(shared_ptr<U> const & r); // never throws

Requires: The expression static_cast<T*>(r.get()) @@ -482,7 +482,7 @@ q = p; object twice.

shared_dynamic_cast

-
template<typename T, typename U>
+		
template<class T, class U>
   shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r);

Requires: The expression dynamic_cast<T*>(r.get()) @@ -503,7 +503,7 @@ q = p; object twice.

shared_polymorphic_cast

-
template<typename T, typename U>
+		
template<class T, class U>
   shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r);

Requires: The expression @@ -517,7 +517,7 @@ q = p;

Exception safety: If an exception is thrown, the function has no effect.

shared_polymorphic_downcast

-
template<typename T, typename U>
+		
template<class T, class U>
   shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r); // never throws

Requires: The expression diff --git a/smart_ptr_test.cpp b/smart_ptr_test.cpp index eead369..0d02f8b 100644 --- a/smart_ptr_test.cpp +++ b/smart_ptr_test.cpp @@ -42,7 +42,7 @@ using boost::scoped_array; using boost::shared_ptr; using boost::shared_array; -template +template void ck( const T* v1, T v2 ) { BOOST_TEST( *v1 == v2 ); } namespace { diff --git a/weak_ptr.htm b/weak_ptr.htm index 92bc284..d0273b4 100644 --- a/weak_ptr.htm +++ b/weak_ptr.htm @@ -61,21 +61,21 @@ if(shared_ptr<int> r = make_shared(q))

Synopsis

namespace boost {
 
-  template<typename T> class weak_ptr {
+  template<class T> class weak_ptr {
 
     public:
       typedef T element_type;
 
       weak_ptr();
-      template<typename Y> weak_ptr(shared_ptr<Y> const & r); // never throws
+      template<class Y> weak_ptr(shared_ptr<Y> const & r); // never throws
       ~weak_ptr(); // never throws
 
       weak_ptr(weak_ptr const & r); // never throws
-      template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never throws
+      template<class Y> weak_ptr(weak_ptr<Y> const & r); // never throws
 
       weak_ptr & operator=(weak_ptr const & r); // never throws  
-      template<typename Y> weak_ptr & operator=(weak_ptr<Y> const & r); // never throws
-      template<typename Y> weak_ptr & operator=(shared_ptr<Y> const & r); // never throws
+      template<class Y> weak_ptr & operator=(weak_ptr<Y> const & r); // never throws
+      template<class Y> weak_ptr & operator=(shared_ptr<Y> const & r); // never throws
 
       void reset();
       T * get() const; // never throws; deprecated, will disappear
@@ -86,16 +86,16 @@ if(shared_ptr<int> r = make_shared(q))
       void swap(weak_ptr<T> & b); // never throws
   };
 
-  template<typename T, typename U>
+  template<class T, class U>
     bool operator==(weak_ptr<T> const & a, weak_ptr<U> const & b); // never throws
-  template<typename T, typename U>
+  template<class T, class U>
     bool operator!=(weak_ptr<T> const & a, weak_ptr<U> const & b); // never throws
-  template<typename T>
+  template<class T>
     bool operator<(weak_ptr<T> const & a, weak_ptr<T> const & b); // never throws
 
-  template<typename T> void swap(weak_ptr<T> & a, weak_ptr<T> & b); // never throws
+  template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b); // never throws
 
-  template<typename T>
+  template<class T>
     shared_ptr<T> make_shared(weak_ptr<T> const & r); // never throws
 
 }
@@ -118,7 +118,7 @@ if(shared_ptr<int> r = make_shared(q))
 			

Notes: T need not be a complete type. See the smart pointer common requirements.

-
template<typename Y> weak_ptr(shared_ptr<Y> const & r); // never throws
+
template<class Y> weak_ptr(shared_ptr<Y> const & r); // never throws

Effects: Constructs a weak_ptr, as if by storing a copy of the pointer stored in r.

@@ -128,7 +128,7 @@ if(shared_ptr<int> r = make_shared(q)) stored pointer become 0.

weak_ptr(weak_ptr const & r); // never throws
-template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never throws
+template<class Y> weak_ptr(weak_ptr<Y> const & r); // never throws

Effects: Constructs a weak_ptr, as if by storing a copy of the pointer stored in r.

@@ -147,8 +147,8 @@ template<typename Y> weak_ptr(weak_ptr<Y> const & r); // never t

assignment

weak_ptr & operator=(weak_ptr const & r); // never throws
-template<typename Y> weak_ptr & operator=(weak_ptr<Y> const & r); // never throws
-template<typename Y> weak_ptr & operator=(shared_ptr<Y> const & r); // never throws
+template<class Y> weak_ptr & operator=(weak_ptr<Y> const & r); // never throws +template<class Y> weak_ptr & operator=(shared_ptr<Y> const & r); // never throws

Effects: Equivalent to weak_ptr(r).swap(*this).

Throws: nothing.

@@ -205,9 +205,9 @@ template<typename Y> weak_ptr & operator=(sh

Free Functions

comparison

-
template<typename T, typename U>
+		
template<class T, class U>
   bool operator==(weak_ptr<T> const & a, weak_ptr<U> const & b); // never throws
-template<typename T, typename U>
+template<class T, class U>
   bool operator!=(weak_ptr<T> const & a, weak_ptr<U> const & b); // never throws

Returns: a.get() == b.get().

@@ -215,7 +215,7 @@ template<typename T, typename U>

Notes: T need not be a complete type. See the smart pointer common requirements.

-
template<typename T>
+		
template<class T>
   bool operator<(weak_ptr<T> const & a, weak_ptr<T> const & b); // never throws

Returns: an implementation-defined value such that operator< is @@ -227,7 +227,7 @@ template<typename T, typename U> pointer common requirements.

swap

-
template<typename T>
+		
template<class T>
   void swap(weak_ptr<T> & a, weak_ptr<T> & b) // never throws

Effects: Equivalent to a.swap(b).

@@ -236,7 +236,7 @@ template<typename T, typename U> generic programming.

make_shared

-
template<typename T>
+		
template<class T>
   shared_ptr<T> make_shared(weak_ptr<T> & const r) // never throws

Returns: r.expired()? shared_ptr<T>(): shared_ptr<T>(r).