David Abrahams wrote:
on Sat Mar 17 2007, Tobias Schwinger
wrote: The problem comes down to that MPL can't know where one placeholder expression starts and where another one ends (denoted by uppercase identifiers, above):
There is an inherent limitation in that regard. These kinds of problems come up repeatedly, so Aleksey and I agree the library should provide a solution. We had a long discussion on the boost-devel list where we talked about the same issues in terms of runtime lambda expressions:
Oh, thanks!
Incidentally, I provided something very similar to 'outer' (discussed in
that thread) in the follow-up, called 'defer' (inspired by Chaos).
It's so easy, that it's almost provocative:
// returns an unspecified placeholder expression whose evaluation
// results in the original argument, no placeholder substitution
// applied
template<typename PlaceholderExpr>
struct defer
{
template<typename IgnoredPlaceholder> struct get
{
typedef PlaceholderExpr type;
};
typedef typename defer<PlaceholderExpr>::template get<_> type;
};
BOOST_MPL_ASSERT((
is_same
As I said, this thread is long (it contains a whole thread attached to one message in the outer thread -- how appropriate!) but it's worth a read.
Incidentally, protect<> doesn't help as it does something different.
Yes, namely nested binds - I figured that out, by now :-). Regards, Tobias