|
Boost : |
From: Dill, John (john-dill_at_[hidden])
Date: 2004-05-10 12:01:42
I ran into some possibly confusing behavior when trying out the documentation example from bind.
When you have:
struct F
{
int operator()(int a, int b) { return a - b; }
bool operator()(long a, long b) { return a == b; }
};
F f;
int x = 104;
bind<int>(f, _1, _1)(x); // f(x, x), i.e. zero
What could be confusing is when you do this:
long y = 104;
bind<int>(f, _1, _1)(y) // Calls the operator<bool>, not operator<int>
which is counter-intuitive as the documentation says your binding on the return type, but the return type is not actually what function call the type deduction gets.
Does anyone else observe this behavior? I tried this on gcc 3.4.
Thanks,
John
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk