Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2005-12-10 11:35:55


On 12/10/05, David Abrahams <dave_at_[hidden]> wrote:

[snip]

>
> That isn't really a complete solution:
>
> struct Base {};
> struct Derived : Base {};
> struct Bottom : Derived {};
>
> int f(shared_ptr<Base>); // #1
> int f(shared_ptr<Derived>); // #2
>
> shared_ptr<Bottom> x(new Bottom);
> int y = f(x); // Should call #2, but is ambiguous
>
> will still fail, and there's not really any way to make it work.

But at least completely unmatchable choices wont get in the way,
turning a completely legitimate call an ambigous one.
As was stated in another thread:

struct A {};
struct B {};
struct C : B {};

void foo(shared_ptr<A>);
void foo(shared_ptr<B>);

foo(new C());

doesnt work because of A, that has nothing to do with A...

IMHO, being able to do this is a must.

>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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