« first day (226 days earlier)      last day (4723 days later) » 

Xeo
9:09 PM
Oh my god.. overload resolution, I love you!
Automatic disambiguation of overloaded functions when taking their address...
 
@sbi Oh cool, Kate Gregory noticed the question :)
@Xeo You're not the first to suggest that, I'll see if I can come up with a sensible grouping...
@Xeo How? Does it take into account the usage context?
> a few of the links above are about STL, while ostensibly written in C++, is not directly about C++
Wait a minute, how is the STL not directly about C++?
 
Xeo
9:26 PM
Dammit. Overload resolution still doesn't completely solve the ambiguity.
@FredOverflow oO
 
There is no C++ without the STL.
 
Xeo
@FredOverflow ideone.com/gzlrf
This disambiguates overloads with different parameters, but not on const / non-const
I need a way to do that. :<
 
Well, which version do you want to call?
Also, this program compiles. What's the problem?
 
Xeo
> This disambiguates overloads with different parameters, but not on const / non-const
I needed a way to the part after the "but"
but I just found one. :)
 
Great, I understand nothing and you solve all your problems yourself. I feel like a rubber duck :(
Rubber duck debugging, Rubber Ducking, or the Rubber Duckie Test is an informal term used in software engineering to refer to a method of debugging code. The name is a reference to an apocryphal story in which an unnamed expert programmer would keep a rubber duck by his desk at all times, and debug his code by forcing himself to explain it, line-by-line, to the duck. The process is to meticulously explain code to an inanimate object, such as a rubber duck. It is expected that when the programmer comes across a piece of code that is incorrect, they will realize this Similar terms *Cardbo...
So, how did you solve it?
 
Xeo
9:36 PM
no wait, that still might cause problems..
 
Are you sure the cFoo const* pf parameter makes any difference? Because cFoo f is never const...
 
Xeo
what if the pointer is non-const, but the wanted function is const... ARGH
Basically, this whole stuff is for implementing my delegate class
 
Let me ask again as a rubber duck, if both versions exist, which one do you want to call?
And is one version guaranteed to always exist?
Or is the problem that only one of them might exist?
In other words, please post a piece of code that fails to compile. That would make it easier for me to see the problem.
 
Xeo
I'm currently having difficulties to understand my own problem xD
When I made my mind up, I'm gonna post an example.
 
@FredOverflow Seems like a great way to debug duck-typed programs.
 
9:51 PM
:)
1
A: Array with size 0

NodeI ran this program at ideone.com #include <iostream> int main() { int a[0]; int b[0][100]; int c[100][0]; std::cout << "sizeof(a) = " << sizeof(a) << std::endl; std::cout << "sizeof(b) = " << sizeof(b) << std::endl; std::cout &l...

Please read my comment and discuss.
 
haha, you're right
not sure what i was thinking
 
Did you just get in here? :)
 
yep
 
By accident? Or were you somehow automatically noticed that I posted your answer here?
 
came into the chat a few mins ago to see how it works...then you posted that
 
9:56 PM
What a strange coincidence.
 
yep
 
I better put on my tinfoil hat.
 
Who's been playing with timelines again?
 
@Node I removed my comment.
@CatPlusPlus The novel by Michael Crichton?
 
@Fred I just replied to your comment and edited
 
Xeo
9:58 PM
@CatPlusPlus I'm only playing with world-lines. :)
 
@FredOverflow I... don't know. I've been rewatching last ep of Doctor Who.
I have a test in 7 hours and I'm afraid I'll oversleep if I go to sleep. This sucks.
 
@CatPlusPlus Doctor Who? (warning: possible infinite recursion)
 
@FredOverflow Yes.
Recursion averted.
 
You're no fun :(
 
-funroll-loops.
 
Xeo
10:02 PM
@CatPlusPlus -funroll-infinite-recursion
 
No, really, I have a dilemma. Not sleeping = bad. Possibility of oversleeping = even worse.
 
Xeo
@CatPlusPlus Get yourself 5 alarmclocks
 
I either wake up before the clock, or loooooooong after.
And if I wake up, I have like 40% chance of falling asleep again, and going straight to option 2.
 
...and put the alarm clocks all over the room
 
And have flatmates kill me. Yeah, that would certainly resolve the problem.
 
Xeo
10:05 PM
I really do like to forget the () in operator(): void operator(int a, int b)
 
#define operator operator()
What could possibly go wrong.
 
Xeo
:)
 
haha
 
Xeo
You'd be inventing new operators
like the tinfoil-hat-operator: operator()>
 
Operators operators operators.
 
Xeo
10:08 PM
Ooookay @FredO, I think I finally made up my mind
First, take a look at this ideone example: ideone.com/AkX1t
I can't bind the operator() of Foo to my generic bound_func because it's overloaded and I don't provide and explicit or implicit cast
 
Why are you even taking the address of operator()? Why don't you just store the functor directly?
 
Xeo
@FredOverflow See the comment at the union
I don't want to use some extremely verbose trickery like std::/boost::function
That is, my calling syntax is extremely short and, most importantly, consistent regardless of what was bound
for example on x86, compiled with visual studio: with a delegate<R()> (i.e., no parameters) these two lines will allow me to invoke a bound free function pointer, a member function pointer and a functor:
__asm mov ecx, dword ptr [this]; // visual studio way of passing `this`, GCC passes as hidden first parameter
__asm call dword ptr [this+4]; // call the function pointer, regardless of member or free one
And this assembly magic will be hidden behind a platform-dependent macro
Now, this ambiguity is easily fixed by introducing overloads based on the functors constness: ideone.com/dfziK
Okay, now I see the flaw in my question. If the user does delegate<T> d; d.bind(f); d(); it's never clear which overload should be chosen..
Lets take a look how boost solves that...
Okay, overload is chosen on the const-ness of the function<Sig> itself
makes sense
Dang, I got to go, but I made a valuable conclusion. Thanks for rubber ducking for me @FredO. :P
 
11:13 PM
Has Hans Passant suffered a family bereavement or something? He's being even more of a dick than usual.
 

« first day (226 days earlier)      last day (4723 days later) »