|
Boost : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-22 11:24:12
AMDG
Larry Evans wrote:
> Could you post a test case with the before (only 1 expr with 3 args)
> and after (i.e. 2 expr templates where proto::expr takes 2 args and
> proto::detail::expr takes 3 args, where the 3ird is the arity) and
> then maybe some example in proto which specializes on
> arity and show how the 2 expr template method wouldn't work?
>
> Of course I could try it and see if I could make it fail, but
> I was hoping you had a better idea of how to make it (
> i.e. the 2 expr method) fail.
>
template<class Tag, class Args, int arity = Args::arity>
struct expr3;
template<class Tag, class Args>
struct expr3<Tag, Args, 2> {
typename Args::arg0 arg0;
typename Args::arg1 arg1;
};
template<class Tag, class Args>
struct expr2 {
expr3<Tag, Args> args;
};
struct test {
int i;
};
struct my_args {
enum { arity = 2 };
typedef test arg0;
typedef test arg1;
};
struct my_tag {};
int main() {
expr3<my_tag, my_args> x3 = { {1}, {1} };
expr2<my_tag, my_args> x2 = { {1}, {1} }; // error C2078: too many
initializers
}
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk