|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2006-07-26 10:13:41
On Jul 26, 2006, at 4:55 AM, John Maddock wrote:
> Won't bool isnormal(const Person&) be the better overload and
> therefore the
> one called? The worst I can see happening is an "ambiguous
> overload" error.
Fwiw, here's a standalone test. But at this point it's academic as I
didn't know about boost::math which I think is probably sufficient
protection.
#include <iostream>
namespace boost
{
template <class T>
bool
isnormal(T t) {std::cout << "boost::isnormal\n"; return true;}
template<class T>
class optional {};
}
namespace Mine
{
struct sense_of_humor {};
struct Person : private boost::optional<sense_of_humor> {};
struct Female : public Person {};
bool isnormal(const Person&) {std::cout << "Mine::isnormal\n"; return
false;}
bool foo()
{
Female Jane;
return isnormal(Jane);
}
}
int main()
{
Mine::foo();
}
This prints out "boost::isnormal" for me.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk