Alf P. Steinbach wrote:[color=blue]
> Not yet perfect, but:
>
>
http://home.no.net/dubjai/win32cpptu...ters/ch_01.pdf
>
http://home.no.net/dubjai/win32cpptu...1_examples.zip
>
> To access the table of contents, use the "Bookmarks" tab in Adobe
> Acrobat.
>
> Comments, corrections, praise, nits, etc., are still welcome!
>
> 1 Pointers.
> 1.1 Introduction to the basics.
> 1.1.1 How to obtain a pointer to a given object, and how to use that pointer.
> 1.1.2 The nullpointer value, valid and invalid pointers.
> 1.1.3 How to implement out-arguments by using pointers.
> 1.1.4 How to implement in-arguments by using pointers.
> 1.1.5 How to use C++ style references instead of C style pointers for arguments.
> 1.1.6 How to access main arguments.
> 1.1.7 Const-correctness for pointers and references.
> 1.2 Run-time polymorphism.
> 1.2.1 Polymorphism.
> 1.2.2 The concepts of data representations and linked data structures.
> 1.2.3 C-style polymorphism with simulated dynamic types (just one actual type).
> 1.2.4 Basic use of dynamic memory allocation & deallocation.
> 1.2.5 How to use function pointers to simulate dynamic types, C-style.
> 1.2.6 Using real types and inheritance for logical sub-types, mostly C-style.
> 1.2.7 Using vtables, mostly C-style (also a few words about abstract classes, etc.).
> 1.2.8 C++ virtual member functions.
> 1.2.9 C++ destructors and polymorphic delete.
> 1.3 Safety for dynamically allocated objects.
> 1.3.1 Object ownership and the C++ std::auto_ptr.
> 1.3.2 Exception safety for new: RAII and C++ constructors.
> 1.3.3 Ensure dynamic allocation by using C++ access specifiers & friendship.
> 1.3.4 An aside on wrapping boost::shared_ptr (a.k.a. std::tr1::shared_ptr).
> 1.3.5 Ensure that smart pointers are used, by overloading operator new.
> 1.3.6 Combat slicing by removing access to copy assignment.
> 1.3.7 Value copying problems & possible solutions.
> 1.3.8 Cloning as a solution to ownership and aliasing problems.
> 1.3.9 Intentional sharing as a solution to ownership and aliasing problems.
> 1.4 An introduction to exceptions.
> 1.4.1 How to generate and handle exceptions.
> 1.4.2 Exception usage example: conversion between numeric values and text.
> 1.4.3 Exceptions and pointers, including the concept of "hard" exceptions.
> 1.5 Basic serialization and de-serialization.
> 1.5.1 A serialization format for hierarchical data structures.
> 1.5.2 De-serialization: a simple non-OO recursive descent parser.
> 1.5.3 Serialization: a simple generator using intrusive OO code.
> 1.5.4 A generator using non-intrusive non-OO code (introducing C++ RTTI).
> 1.5.5 A generator using non-intrusive OO code (introducing the visitor pattern).
> 1.6 Notes on C++ inheritance as it pertains to pointers.
> 1.6.1 Passing Base/Derived-class pointers by reference.
> 1.6.2 The Liskov substitution principle (more about mutable/immutable).
> 1.6.3 Covariance, contravariance and invariance.
> 1.7 Closing words & acknowledgements.
>
> --
> A: Because it messes up the order in which people normally read text.
> Q: Why is it such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing on usenet and in e-mail?[/color]
Section 1.3.8 and 1.3.9 talk about a clone solution that requires a
virtual clone function, and then states this as a problem with using a
clone solution.
However, you can use a clone solution that does not require the base
class to ahve a virtual clone function (or derived class having clone
function).
See following clone smart pointers:
http:://code.axter.com/copy_ptr.h
http:://code.axter.com/cow_ptr.h
http:://code.axter.com/clone_ptr.h
All above clone smart pointers do not require clone functions for the
target T type.
This section makes the comparison between using clone method and using
boost::shared_ptr method, but I didn't see it mention the real reason
why you might need a clone method over a boost::shared_ptr method, and
the pros of using a clone smart pointer over using a shared_ptr.
See following link for more info:
http://www.codeguru.com/Cpp/Cpp/algo...le.php/c10407/