Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-02-26 13:39:09


> > struct foo : public has_sig
> > {
> >
> > template<class Arg>
> > struct sig {
>
> Yes, it's doable. My 'expression' library used a standalone template:
>
> template<class F, class A1 = missing, class A2 = missing> struct ret
> {
> typedef ... type;
> };

...

> Using a separate class instead of a nested 'sig' is non-intrusive, i.e. it
> works with function objects that don't necessarily know about the expression
> template library. (The default ret<> still returns F::result_type.)

Yes, this (standalone return type traits templates) is the way LL handles
most of the return type deductions.
And it is possible to provide specializations for those templates as well
to get the same effect.
The sig-template inside a functor is comaparable to providing the
result_type typedef inside the functor.

> Either way, I still think that the right approach is to write a "why typeof"
> paper instead of coming up with cunning workarounds for the language
> shortcomings. (hint) :-)
I agree.

/Jaakko


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk