Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-06-13 23:13:32


"Douglas Gregor" <gregod_at_[hidden]> wrote in message
news:200206132337.43800.gregod_at_cs.rpi.edu...
> On Thursday 13 June 2002 07:54 pm, Itay Maman wrote:
> > 2. Is direct recursion (i.e: variant<int, rec>) allowed?
> > I think we should not allow instantiations like this:
> > variant<int, rec> v1;
>
> Direct recursion seems to cause more headaches than it fixes
problems.

Direct recursion would be *very* desirable. I could enable it in a
couple of limited instances, but unfortunately not in the general
case.

The classic example is when you want to define a tree. A binary tree
node is either a leaf or a pair of tree nodes:

typedef Variant<TYPELIST_2(Leaf, std::pair<Self*, Self*>)>
    TreeNode;

Andrei


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