|
Boost : |
From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-02-20 14:12:19
> Well the problem I see is that we are using an entity with
> "pointer" written
> all over it (the name especially, but also the primary
> semantics). Surely
> managing general resources according to RAII principles is a
> more general
> concept than managing pointers to objects?
> At the very least there should be a smart resource concept,
> perhaps embodied
> in a shared_resource template or, better still, a policy-based
> smart_resource. shared_ptr/ smart_ptr may then be specialisations or
> instantiations of these.
> I have argued previously that these concepts should be kept
> separate such
> that smart_resource is a parallel concept to smart_ptr, but
> recently I am
> inclined to agree that there is a relationship. However many
> (most?) of the
> smart_ptr proponents seem to favour assimilating the smart
> resource concept
> into smart_ptr itself!
1. It's all only word games. smart_ptr does not really *point* to resource,
or *refer* to the resource. In essence it MANAGE the resource.
The way it point/refer to the resource is secondary (it may be c++ pointer,
c++ reference, some kind of handle and so on). So the best name
may be smart_manager, or even smart_resource_maanger. But I would prefer
existent name. It's well esteblished idiom: you say smart pointer - one
understand that we are talking about resource management.
2. As for the difference in semantics between generic smart_resource and
smart_prt, I argue that once you start implementing generic all purpose
framework for smart resource management you will end up with the same
semantics as smart_ptr has (there may be some minor differencies with
comparison operators)
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk