David Abrahams writes:
Aleksey Gurtovoy wrote:
From http://www.boost.org/libs/mpl/doc/refmanual/protect.html:
'protect' is an identity wrapper for a Metafunction Class that prevents its argument from being recognized as a bind expression.
Actually, the above definition is incomplete; should be:
'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". 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. -- Aleksey Gurtovoy MetaCommunications Engineering