Boost Users :
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2005-01-04 04:17:25
David Abrahams writes:
> 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)
It doesn't prevent a "premature substition" of placeholders. It prevents it
once and for all.
> 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
Reciting the rewrite of the OP code from my original reply:
template< typename Map, typename Entry >
struct copy_entires // scope #2
, inserter<Map, insert<_1,_2> >
typedef fold< // scope #1
-- Aleksey Gurtovoy MetaCommunications Engineering
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net