|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-27 16:59:50
On Wednesday 27 June 2001 12:07, you wrote:
> > Consider this little tidbit of overload resolution:
> >
> > struct Foo {
> > template<typename T> Foo& operator=(const T&);
> > };
> >
> > struct Bar : public Foo {
> > template<typename T> Bar(T);
> > Bar& operator=(const Bar& other);
> > };
> >
> > Bar b;
> > b = 5;
> >
> > So what happens at b=5? Clearly the candidates are either:
> > 1) a call to Foo::operator=(T). This requires:
> > 2) a call to Bar::operator=(const Bar&)
>
> I believe that Foo::operator= will never be considered because its name is
> hidden by Bar::operator=.
>
> -Brad
I can't believe I missed that... It appears that the 'thin wrapper' approach
of 'function' is becoming very, very fat.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk