Boost logo

Boost :

From: Powell, Gary (powellg_at_[hidden])
Date: 2003-10-17 17:19:30


Actually,

    switch_(condition)
    [
        case_(label1)[expr1],
        case_(label2)[expr2],
        case_(label3)[expr3]
        default_[expr4]
    ]
----------------------------------
has problems with "default_[expr4]"

but I think

    switch_(condition)
    [
        case_(label1)[expr1],
        case_(label2)[expr2],
        case_(label3)[expr3]
        .default_[expr4]
    ]

or
    switch_(condition)
    [
        case_(label1)[expr1],
        case_(label2)[expr2],
        case_(label3)[expr3],
        default_(expr4)
    ]

could be made to work.

The nice thing about having .default is that it could end the sequence of case_()[]'s by generating a unique expression template which would not allow either a operator,(expression) or operator,(case_expression).

what you also want to avoid is allowing:

    switch_(condition)
    [
        case_(label1)[expr1],
        expr1a,
        case_(label2)[expr2],
        case_(label3)[expr3]
        .default_[expr4]
    ]

or

    switch_(condition)
    [
        case_(label1),
        expr1,
        case_(label2)[expr2],
        case_(label3)[expr3]
        .default_[expr4]
    ]

or
    switch_(condition)
    [
        case_(label1),
        expr1,
        case_(label2)[expr2]
       .default_[expr4],
        case_(label3)[expr3]
 
    ]

where a useless expression is inserted into the middle of the case statements.

BTW, Jaakko and I did most of this work a while ago, playing around, but if Phoenix-2 the merger of LL and Phoenix is due out, there is no point in pushing updates to LL.

    -Gary-
 


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