Boost logo

Boost :

From: Hartmut Kaiser (HartmutKaiser_at_[hidden])
Date: 2004-05-27 01:57:31


 
Thorsten Ottosen wrote:

> "The rule is a wierd C++ citizen, unlike any other C++
> object. It does not have the proper copy and assignment
> semantics and cannot be stored and passed around by value.
> You cannot store rules in STL containers (vector, stack, etc)
> for later use and you cannot pass and return rules to and
> from functions by value."
>
> I have read this page before, but I still don't get why the
> rule has copy and assignment semantics at all.
> Afterall, you admit copying and assignment does not make
> sense, yet it is still defined :-) What am I overlooking? Why
> do we need the current copy/assignment semantics?

That's to allow to write:

    rule<> a = /* some spirit parser here */;
    rule<> b = a;

Which is needed (or at least handy) in some parser contexts.

Regards Hartmut


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