[C++-sig] Just about to release

David Abrahams dave at boost-consulting.com
Wed Oct 9 21:57:12 CEST 2002


Stefan Seefeld <seefeld at sympatico.ca> writes:

> David Abrahams wrote:
> 
> >> And what about 'str' ?
> > str is fine.
> >
> >>How is the link to 'operator <<' established ?
> > In the same way that "self + self" establishes a link to
> > operator+(Rational,Rational) (or whatever the signature ends up
> > being).
> 
> ah, expression templates...

Precisely.

> >>Something is missing here...
> > What is it?
> 
> well, probably just my insight :-)
> 
> While 'pow' is declared a few lines above, 'str'
> isn't. So I guess it's declared elsewhere as a template
> that delegates to 'operator <<', which would provide
> the missing link...

I agree that it would help if the tutorial docs mentioned explicitly
that operator<< is used by the method defined by
def(str(self)). However, the tutorial is definitely /not/ supposed to
provide insight into how things are implemented.

-- 
           David Abrahams * Boost Consulting
dave at boost-consulting.com * http://www.boost-consulting.com





More information about the Cplusplus-sig mailing list