Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-05-27 02:09:40


Joel de Guzman wrote:

>
> Consider:
>
> rule<> a = x;
>
> or:
>
> rule<> a;
> a = x;
>
> How should this behave if x is an int_p?

The int_p gets stored in an object on the heap, and the rule<> stores a
shared_ptr to a polymorphic base.

> Now how should it behave if
> x is another rule? Consider a concrete example (snipped from the pascal
> parser):
>
> rule<> identifier;
> rule<> fileIdentifier;
>
> identifier = ....
>
> fileIdentifier = identifier; // an alias
>

The shared_ptr's reference count goes up. What's the problem?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk