+ @b Example:
+
+ Below is an example of using a wxWidgets scoped smart pointer and pointer array.
+
+ @code
+ class MyClass{ ... };
+
+ // declare a smart pointer to a MyClass called wxMyClassPtr
+ wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
+ // declare a smart pointer to an array of chars
+ wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
+
+ ...
+
+ // define the first pointer class, must be complete
+ wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
+ // define the second pointer class
+ wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
+
+ // create an object with a new pointer to MyClass
+ wxMyClassPtr theObj(new MyClass());
+ // reset the pointer (deletes the previous one)
+ theObj.reset(new MyClass());
+
+ // access the pointer
+ theObj->MyFunc();
+
+ // create an object with a new array of chars
+ wxCharArray theCharObj(new char[100]);
+
+ // access the array
+ theCharObj[0] = "!";
+ @endcode
+
+ @section wxscopedptr_newpointers Declaring new smart pointer types
+
+ To declare the smart pointer class @c CLASSNAME containing pointes to
+ a (possibly incomplete) type @c TYPE you should use
+ @code
+ wxDECLARE_SCOPED_PTR( TYPE, // type of the values
+ CLASSNAME ); // name of the class
+ @endcode
+ And later, when @c TYPE is fully defined, you must also use
+ @code
+ wxDEFINE_SCOPED_PTR( TYPE, CLASSNAME );
+ @endcode
+ to implement the scoped pointer class.
+
+ The first argument of these macro is the pointer type, the second is the name
+ of the new smart pointer class being created. Below we will use wxScopedPtr
+ to represent the scoped pointer class, but the user may create the class with
+ any legal name.
+
+ Alternatively, if you don't have to separate the point of declaration and
+ definition of this class and if you accept the standard naming convention,
+ that is that the scoped pointer for the class @c Foo is called @c FooPtr,
+ you can use a single macro which replaces two macros above:
+ @code
+ wxDEFINE_SCOPED_PTR_TYPE( TYPE );
+ @endcode
+ Once again, in this cass @c CLASSNAME will be @c TYPEPtr.
+