mirror of https://github.com/CGAL/cgal
- [Simple_]Handle_for<> protection cleanup, non-const Ptr() added.
This commit is contained in:
parent
0dd3c3639e
commit
9f6dbfbbf6
|
|
@ -1,3 +1,6 @@
|
|||
3.58 (3 October 2001)
|
||||
- [Simple_]Handle_for<> protection cleanup, non-const Ptr() added.
|
||||
|
||||
3.57 (12 September 2001)
|
||||
- Fixes for SunPro.
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ class Handle_for
|
|||
{
|
||||
public:
|
||||
|
||||
typedef RefCounted element_type;
|
||||
|
||||
Handle_for(const RefCounted& rc)
|
||||
{
|
||||
ptr = allocator.allocate(1);
|
||||
|
|
@ -105,12 +103,35 @@ class Handle_for
|
|||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef RefCounted element_type;
|
||||
|
||||
void
|
||||
initialize_with( const RefCounted& rc)
|
||||
{
|
||||
allocator.construct(ptr, rc);
|
||||
}
|
||||
|
||||
bool
|
||||
identical( const Handle_for& h) const
|
||||
{ return ptr == h.ptr; }
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>(&*ptr); }
|
||||
|
||||
typename Allocator::const_pointer
|
||||
Ptr() const
|
||||
{ return ptr; }
|
||||
|
||||
typename Allocator::pointer
|
||||
Ptr()
|
||||
{
|
||||
copy_on_write();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// private:
|
||||
void
|
||||
copy_on_write()
|
||||
{
|
||||
|
|
@ -123,19 +144,6 @@ class Handle_for
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
identical( const Handle_for& h) const
|
||||
{ return ptr == h.ptr; }
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>( &(*ptr)); }
|
||||
|
||||
const typename Allocator::pointer
|
||||
Ptr() const
|
||||
{ return ptr; }
|
||||
|
||||
protected:
|
||||
static Allocator allocator;
|
||||
typename Allocator::pointer ptr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@ class Simple_Handle_for
|
|||
{
|
||||
public:
|
||||
|
||||
typedef Stored element_type;
|
||||
Simple_Handle_for()
|
||||
{}
|
||||
|
||||
Simple_Handle_for(const Stored& rc)
|
||||
: _s(rc) {}
|
||||
|
||||
Simple_Handle_for()
|
||||
{}
|
||||
protected:
|
||||
typedef Stored element_type;
|
||||
|
||||
void
|
||||
initialize_with(const Stored& rc)
|
||||
|
|
@ -43,10 +44,6 @@ public:
|
|||
_s = rc;
|
||||
}
|
||||
|
||||
void
|
||||
copy_on_write()
|
||||
{}
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>(&_s); }
|
||||
|
|
@ -58,7 +55,14 @@ public:
|
|||
const Stored * Ptr() const
|
||||
{ return &_s; }
|
||||
|
||||
Stored * Ptr()
|
||||
{ return &_s; }
|
||||
|
||||
private:
|
||||
void
|
||||
copy_on_write()
|
||||
{}
|
||||
|
||||
Stored _s;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ class Handle_for
|
|||
{
|
||||
public:
|
||||
|
||||
typedef RefCounted element_type;
|
||||
|
||||
Handle_for(const RefCounted& rc)
|
||||
{
|
||||
ptr = allocator.allocate(1);
|
||||
|
|
@ -105,12 +103,35 @@ class Handle_for
|
|||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef RefCounted element_type;
|
||||
|
||||
void
|
||||
initialize_with( const RefCounted& rc)
|
||||
{
|
||||
allocator.construct(ptr, rc);
|
||||
}
|
||||
|
||||
bool
|
||||
identical( const Handle_for& h) const
|
||||
{ return ptr == h.ptr; }
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>(&*ptr); }
|
||||
|
||||
typename Allocator::const_pointer
|
||||
Ptr() const
|
||||
{ return ptr; }
|
||||
|
||||
typename Allocator::pointer
|
||||
Ptr()
|
||||
{
|
||||
copy_on_write();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// private:
|
||||
void
|
||||
copy_on_write()
|
||||
{
|
||||
|
|
@ -123,19 +144,6 @@ class Handle_for
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
identical( const Handle_for& h) const
|
||||
{ return ptr == h.ptr; }
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>( &(*ptr)); }
|
||||
|
||||
const typename Allocator::pointer
|
||||
Ptr() const
|
||||
{ return ptr; }
|
||||
|
||||
protected:
|
||||
static Allocator allocator;
|
||||
typename Allocator::pointer ptr;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@ class Simple_Handle_for
|
|||
{
|
||||
public:
|
||||
|
||||
typedef Stored element_type;
|
||||
Simple_Handle_for()
|
||||
{}
|
||||
|
||||
Simple_Handle_for(const Stored& rc)
|
||||
: _s(rc) {}
|
||||
|
||||
Simple_Handle_for()
|
||||
{}
|
||||
protected:
|
||||
typedef Stored element_type;
|
||||
|
||||
void
|
||||
initialize_with(const Stored& rc)
|
||||
|
|
@ -43,10 +44,6 @@ public:
|
|||
_s = rc;
|
||||
}
|
||||
|
||||
void
|
||||
copy_on_write()
|
||||
{}
|
||||
|
||||
long int
|
||||
id() const
|
||||
{ return reinterpret_cast<long int>(&_s); }
|
||||
|
|
@ -58,7 +55,14 @@ public:
|
|||
const Stored * Ptr() const
|
||||
{ return &_s; }
|
||||
|
||||
Stored * Ptr()
|
||||
{ return &_s; }
|
||||
|
||||
private:
|
||||
void
|
||||
copy_on_write()
|
||||
{}
|
||||
|
||||
Stored _s;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue