Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-12-19 21:20:19


Hi,

Is there a chance that we can add an operator() to the
reference wrapper? In particular, I would like to be able
to use it as a nullary functor. This would obviously be very
useful and should not disrupt the current code. In particular,
consider Spirit's conditional parsers (as once asked by
Beman).

    if_p(c)
    [
        parse_this
    ]

The condition is expected to be a functor that returns
a boolean condition. I was hoping that I can use the
ref(b) as a functor such that I can write:

    bool b;

    if_p(ref(b))
    [
        parse_this
    ]

Of course I can metaprogram the condition to dispatch
appropriately when the condition is a reference_wrapper
but it wouldn't be as simple and elegant.

Thoughts? TIA.

Joel de Guzman
joel_at_[hidden]
http://www.boost-consulting.com


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