Vincent RICHOMME wrote:
I would like to create a class called ArrayPtr that could only store
pointers. How can I be sure that arguments passed is a pointer ?
See Fredericks posting, which works in principle (VerifyFuncDecl was
declared twice, so you can only use his macro once in a class definition).
If you want to delete pointers, you know they're C-style pointers, so
you can just take the value type as a template argument:
template<typename Tclass ArrayPtr : public std::vector<T*>
{
public:
....
However, this is probably not something you want to do.
You generally not use delete but use libraries that do the management
for you. If you have access to boost or tr1, use a vector of shared_ptrs.
If not, build your own smart pointer or build the memory management into
a base class of your managed objects. Don't mess around with a memory
managed array unless you have some special reason to do it.
Jens