|
Boost : |
From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-06-14 03:18:06
Andrei Alexandrescu wrote:
> "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;
>
>
Your example is not what I call 'direct recursion'.
If 'rec' is the pseudo keyword for recursion, then I would like to
disallow instantiations where 'rec' appears as-is in the type-list:
typedef Variant<rec, string, char*> Concrete_variant;
-Itay
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk