|
Boost Users : |
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2007-07-28 03:24:45
David Abrahams <dave <at> boost-consulting.com> writes:
> on Fri Jul 27 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
>
> > According to the MPL reference, a placeholder expression
> > X<a1,..,an> must satisfy (among others) the following
> > condition:
> >
> > "All of X's template parameters, including the
> > default ones, are types."
> >
> > According to that the following should then compile
> > without errors:
[...]
> I don't see how you can conclude the above will compile without error
> just from (a part of) the definition of placeholder expression.
>
> Are you saying that since foo<_1> is not a placeholder expression,
> when applied to int it should be treated as a metafunction class?
Yes, this is exactly my point. Another way in which foo<_1>
can be forced to not be treated as a ph expression is this:
// no of parms > BOOST_MPL_LIMIT_METAFUNCTION_ARITY
template<typename T,
typename=int,typename=int,typename=int,
typename=int,typename=int>
struct foo
{
template<typename Q>
struct apply{
typedef Q type;
};
};
You can try yourself this variation and see that the program
really resolves to t1 <- int. But for some reason, the
int=0 variation does not do the same, at least in GCC 3.4.4.
JoaquÃn M López Muñoz
Telefónica, Investigación y Desarrollo
PS: I'd greatly appreciate if you could you try the snippet
(the int=0 version) with other compilers --my current compiler
count is so very limited. Thx!
PPS: In case you're wondering, this is not a purely academic
question: I've got a real world scenario where I want to
prevent foo<x> from being treated as a ph expression, namely
when foo<x> is a metafunction class parameterized by
a lambda expression (i.e. a ph expression or metafunction
class) x.
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