|
Boost : |
From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-10-13 04:42:40
----- Original Message -----
From: "Joel de Guzman" <djowel_at_[hidden]>
> ----- Original Message -----
> From: "Hartmut Kaiser" <hartmutkaiser_at_[hidden]>
>
>
> > Joel de Guzman wrote:
> >
> > > A solution I have in mind is make the rule class accept a
> > > bool template parameter ... bool copyable = false>. When one
> > > needs to deal with dynamic parsing which will involve the
> > > manipulation of rules, placing them in stacks, maps, vectors etc.,
> > > then she can set it to true. All the rest will be happy with this
> > > set to false as default.
> >
> > Seem to solve all problems at once: no confusion anymore for the average
> > Spirit user and the possibility to fine tune things for special cases.
> > This BTW reflects the situation, we had in Spirit V1.3, there the rule<>
> > had the 'non-confusing' semantics and the copyable_rule<> the sematics,
> > the rule<> have today. One note though: we need to expose the actual
> > rule semantics through a typedef to allow for meta tricks.
>
> Agreed. In addition, we'll need some means to bidirectionally assign from
> both types of rules.
Another solution that I seem to like would be to simply revert to
v1.3 behavior while still using smart pointers. Then, an auxilliary
class rule_holder<RuleT> can be used to hold rules for storage
in containers. The rule_holder manages the lifetime of the held
rule. You can get, set or reset the held rule.
I think I prefer this solution. Thoughts?
--Joel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk