|
Boost : |
From: Philippe A. Bouchard (philippe_at_[hidden])
Date: 2003-08-05 12:09:20
Brock Peabody wrote:
> That's a cool idea. It's a lot prettier than using the preprocessor.
Thanks, Brock.
> Does anyone know whether or not a language solution is being
> considered
> for this or variable class template arguments?
It would be valueable for expressions only, not declarator lists. But in
general those infinite parameters function instanciations happens mostly for
function overloading.
[...]
>> int main()
>> {
>> foo((infinite::begin, true, (char *) "adasd", 12367, 127.2));
>> }
The previous syntax or the following by using a px() helper which would
generate another type:
template <typename T>
struct p_t
{
T const & t;
...
};
template <typename T>
p_t<T> px(T const & p)
{
return p_t<T>(p);
}
template <...>
infinite< V, infinite<T, U> > operator , (infinite<T, U> const & u,
p_t<V> const & p)
{
return infinite< V, infinite<T, U> >(u, p.t);
}
...
int main()
{
foo((px(true), px((char *) "adasd"), px(12367), px(127.2)));
}
My 0,03$
Philippe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk