|
Boost : |
From: Steven Watanabe (steven_at_[hidden])
Date: 2007-11-29 23:54:02
AMDG
Alexander Nasonov <alnsn <at> yandex.ru> writes:
>
> int i;
> void BOOST_LOCAL_FUNCTION(i) char c)
> {
> } ...
>
> Note missing '(' in the first line.
>
Hmmm, what about adding another parenthesis before?
void (BOOST_LOCAL_FUNCTION(i) char c)
I don't really like that either...
How about allowing either:
void BOOST_LOCAL_FUNCTION(BOOST_LOCAL_FUNCTION_BIND(i), char c)
or
void BOOST_LOCAL_FUNCTION(char c)
depending on whether binding is needed?
I haven't thought about it too hard, but I think it should be possible
to handle both.
void BOOST_LOCAL_FUNCTION(BOOST_LOCAL_FUNCTION_BIND((ref i)), char c)
could expand to
void
// BOOST_LOCAL_FUNCTION
result_type_getter();
typedef ... result_type;
void* bound_args = 0;
typedef struct {
static result_type body
//BOOST_LOCAL_FUNCTION_BIND
();
} ignore;
boost::tuple<int&> bound_args_impl;
bound_args = &bound_args
typedef struct {
static result_type body(int&, end_of_bound_args_t,
, char c) {
// function body goes here
}
//BOOST_LOCAL_FUNCTION_DEF
} impl;
typedef BOOST_TYPEOF(impl::body) function_type;
// now we can use TMP to figure out whether there
// are any bound args, and if so what the tuple<...>
// type is.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk