Aleksey Gurtovoy wrote:
David Abrahams writes:
Aleksey Gurtovoy wrote:
'protect' is an identity wrapper for a Metafunction Class that prevents its argument from being recognized as a bind/placeholder expression.
The main usage for 'protect' is to prevent parametrized metafunction classes from being accidentally treated as a placeholder expression simply because their arguments happened to embed a placeholder.
Hum. Seems a bit counterintuitive that protect doesn't apply equally well to this case.
??? As I tried to explain in my previous reply, 'protect' already has a well-defined semantics in lambda expressions, and it's quite different from what is needed to support "nested scopes".
I understand that you said that, but to me what protect does (prevents the recognition and premature substition of placeholders) looks very similar to what the OP wants. Also, maybe it's just a failure of my imagination, but I have a hard time seeing what the OP wants as "nested scopes."
It would be nice to have a single magic primitive that would work the way you want it to work depending on the particular use case at hand, but I for one have no knowledge of how to implement one.
Well, that certainly is a real obstacle ;-) -- Dave Abrahams Boost Consulting http://www.boost-consulting.com