$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-04-27 04:07:05
Hi,
I made some changes to Loki style smart_ptr approximation that located here:
http://groups.yahoo.com/group/boost/files/Policy%20based%20smart_ptr/
Here list of issues addressed:
1. I made generators for stl-like auto_ptr and auto_array
2. I made generators for boost-like scoped_ptr and scoped_array
3. I made generators for boost-like shared_ptr and shared_array
All generators look like this:
namespace boost {
template<class T>
struct scoped_ptr_generator
{
typedef
resource_mnmt::smart_ptr<resource_mnmt::storage::plain_pointer<T>,
resource_mnmt::ownership::non_shareable,
resource_mnmt::disallow_conversion<T*>,
resource_mnmt::no_check
> type;
};
An alternative wouldbe to inherit from this types. I do not know what is
better yet. shared_ptr generator uses traits to automatically deduce type of
reference counting to use. I presume we could use 'has member' facility here
to add more automation.
4. I added intrusive_ref_counted ownership policy.
5. I redesigned checking policies. Now Checking policy specification would
look like this:
check<>::leak<at_compile_time>
::dereference<at_runtime_using_asert>
6. I added some interpolicies convertions (still some missing)
7. I added one more ownership policy
8. More tests added
9. I checked current smart_ptr_test.cpp using my generators. With exclusion
of missing operator[] all test are passing (well, 3 are failing but this is
because I have for smart_ptr<...> v => v.use_count() = 0, while current
implementation gives 1. Is there specific reason why is that? )
10. Since I did not find a solution for templated free function operator==
in general case I rollback to form where if defines comparisons with U
const*. At least it will work for pointers.
My test is passing on MSVC. Could somebody try to test on different
compilers?
Any Comments?
Regards,
Gennadiy.