
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 23 February 2010, Abderrahmane Madani wrote:
void foo(shared_ptr<D1>) {} void foo(shared_ptr<D2>) {}
int main() { shared_ptr<E> e(new E); foo(e); return 0; } the compiler say that the foo(boost::shared_ptr<E>&)' is ambiguous.
Please, can someone help me to understand why and how can I fix this problem without changing the functions name. Thanks
Boost 1.35 GCC 4.4.1
Your code should work with boost 1.36 or later. Or, does something like the following help? void foo_impl(shared_ptr<D1>, D1 *) {} void foo_impl(shared_ptr<D2>, D2 *) {} template<typename T> void foo(shared_ptr<T> sp) { foo_impl(sp, sp.get()); } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkuD69wACgkQ5vihyNWuA4X31QCgoVlzHMDCUArjsUNWmlydSfvr XNUAoIJJMA+RuBG4A3meuhJDMBOiQ+qK =rGPY -----END PGP SIGNATURE-----