Re: Reference Counting
On Sep 20, 11:34 am, PeterAP...@gmail.com wrote:
Hello to all expect C++ programmer, recently i have developed
a smart pointer class but i don't know how to implement a
reference counting.
My smart pointer is non-intrusive smart pointer.
Then why not just use boost::shared_ptr?
My question is
1. I need a simple reference count ptr class
Is that a question?
2. Does cyclic reference counting can be solved ?
It's possible, but it means extra analysis by the users. In
practice, reference counted pointers are best restricted to
known subsystems, where cycles are known not to occur.
3. Does policy based design is good approaches in smart pointer ?
It depends on how much you like unnecessary complexity.
4. What should i define in smart pointer template class ?
It depends on what you want the class to accomplish. (I've used
a number of different smart pointer classes in my career, for
different purposes.)
5. Does smart pointer syntax correct ?
I'm having trouble parsing that.
In STL, there just write class U = XXX but why i need the
template <class>.
Where do they just write class U = XXX?
What this mean ?
It depends on where it occurs. Try giving a complete example,
so we can figure out what you are talking about.
I know what is template.
This is my code so far.
It looks like a lot of excess complexity for no real purpose.
What is the class template supposed to do? Until you've defined
that, there's no point in writing a line of code. (I'm not
normally one of those "write the tests first" guys, but until
you've defined what the class is supposed to do enough so that
you could write the tests, there's no point in writing any
code.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34