On 08/13/13 13:25, Larry Evans wrote:
On 08/13/13 11:35, Klaim - Joël Lamotte wrote:> On Tue, Aug 13, 2013 at 2:42 PM, Larry Evans
wrote: What if the class hierarchy is used to model a graph that contains cycles. For example, something like a spirit grammar where a non-terminal on the rhs of a non-terminals definition? Wouldn't this require some sort of smart pointer or other garbage collection method with the ability to collect cycles?
My understanding of the proposed container is that it's mostly like having a collection of vectors, one for each final types, but exposing only one base interface in container interface. If I'm correct, I don't see how the problem you describe might be a
problem.
To be clear, you're saying it was not Santiago's intention to use this libray to create something like this class:
class base_container : public base { public: virtual int do_something(int a) const; classifier
collection; };
Rereading the OP, I see: collection.insert( derived_A(21) ); which means a completely new object is created during the insert; hence, no cycles in pointer graph can occur. Sorry for noise.