Zeljko Vrba
David Abrahams wrote:
However, reliably taking the address of an overloaded function involves knowing the exact types in its signature. I'm not sure how you can do that.
I have googled a bit and found the following example in the Microsoft C++ reference: http://tinyurl.com/cljnn
int Func( int i, int j ); int Func( long l );
...
int (*pFunc) ( int, int ) = Func;
Do you see any problems with this?
Not at all. As I said, you need to know the exact signature. The
problem is detecting that the function (or operator<) whose existence
you detect has the exact signature you care about.
Maybe it could be tested by passing a convertible-to-T POD struct
through the function:
// UNTESTED
template <class T>
struct convertible_to { operator T() const; };
namespace tester
{
typedef char (&yes) [1];
typedef char (&no) [2];
struct not_found {};
no is_found(not_found);
yes i_found(...);
not_found operator<(...);
template
I guess it should be possible to take an address of an operator by replacing 'Func' with e.g. 'operator<'. I'll try it and report the result.
I don't think this problem can be solved. -- Dave Abrahams Boost Consulting www.boost-consulting.com