\r
// Author: Andy Rushton\r
// Copyright: (c) Southampton University 1999-2004\r
-// (c) Andy Rushton 2004-2009\r
+// (c) Andy Rushton 2004 onwards\r
// License: BSD License, see ../docs/license.html\r
\r
// A smart pointer is a memory-managing pointer to an object. If you like, it\r
// create a null pointer\r
smart_ptr_base(void);\r
\r
- // create a pointer containing a *copy* of the object using the template parameter C\r
- // this copy is taken because the pointer class maintains a dynamically allocated object\r
- // and the T& may not be (usually is not) dynamically allocated\r
- explicit smart_ptr_base(const T& data) throw(illegal_copy);\r
-\r
// create a pointer containing a dynamically created object\r
// Note: the object must be allocated *by the user* with new\r
// constructor form - must be called in the form smart_ptr_base<type> x(new type(args))\r
//////////////////////////////////////////////////////////////////////////////\r
// explicit function forms of the above assignment and dereference operators\r
\r
- // set the value - note that this does a copy using the C template parameter\r
- void set_value(const T& data) throw(illegal_copy);\r
// get the value\r
T& value(void) throw(null_dereference);\r
const T& value(void) const throw(null_dereference);\r
// to copy the object with the right copy semantics. If the copy functor\r
// is no_copy, an exception will be thrown.\r
\r
+ // create a pointer containing a *copy* of the object using the template parameter C\r
+ // this copy is taken because the pointer class maintains a dynamically allocated object\r
+ // and the T& may not be (usually is not) dynamically allocated\r
+ explicit smart_ptr_base(const T& data) throw(illegal_copy);\r
+\r
+ // set the value - note that this does a copy using the C template parameter\r
+ void set_value(const T& data) throw(illegal_copy);\r
+\r
// make this pointer unique with respect to any other references to the same object\r
// if this pointer is already unique, it does nothing - otherwise it copies the object\r
void make_unique(void) throw(illegal_copy);\r
{\r
public:\r
smart_ptr_nocopy(void) {}\r
- explicit smart_ptr_nocopy(const T& data) : smart_ptr_base<T, no_copy<T> >(data) {}\r
explicit smart_ptr_nocopy(T* data) : smart_ptr_base<T, no_copy<T> >(data) {}\r
- smart_ptr_nocopy<T>& operator=(const T& data) {set_value(data); return *this;}\r
smart_ptr_nocopy<T>& operator=(T* data) {set(data); return *this;}\r
~smart_ptr_nocopy(void) {}\r
};\r