diff --git a/Packages/Kernel_23/changes.txt b/Packages/Kernel_23/changes.txt index cacfa5e7fbf..fdf23c7ac22 100644 --- a/Packages/Kernel_23/changes.txt +++ b/Packages/Kernel_23/changes.txt @@ -1,3 +1,7 @@ +1.62 (26 August 2003) +- Handle_for : Add an assertion that non-const access is non-shared. +- Handle_for : make Ptr() and ptr() be the same. + 1.61 (25 August 2003) - Try to help VC++ in Handle_for. diff --git a/Packages/Kernel_23/include/CGAL/Handle_for.h b/Packages/Kernel_23/include/CGAL/Handle_for.h index 071864445f5..f91af60e8d3 100644 --- a/Packages/Kernel_23/include/CGAL/Handle_for.h +++ b/Packages/Kernel_23/include/CGAL/Handle_for.h @@ -120,20 +120,20 @@ public: id() const { return reinterpret_cast(&*ptr_); } - // Ptr() is the "public" access to the pointer. Both const and non-const. - // non-const does copy-on-write. + // Ptr() is the "public" access to the pointer to the object. + // The non-const version asserts that the instance is not shared. const T * Ptr() const - { return &(ptr_->t); } + { + return &(ptr_->t); + } - /* T * Ptr() { - copy_on_write(); - return ptr_; + CGAL_assertion(!is_shared()); + return &(ptr_->t); } - */ bool is_shared() const @@ -163,13 +163,14 @@ protected: } // ptr() is the protected access to the pointer. Both const and non-const. + // Redundant with Ptr(). T * ptr() - { return &(ptr_->t); } + { return Ptr(); } const T * ptr() const - { return &(ptr_->t); } + { return Ptr(); } };