>>> 1) There is a bug (in current snapshots too) with parsing code like
>>> the following:
>>>
>>> c.f()(x)(y)(z);
>>>
>>> But, this is legal c++.
>>
>> Curious question of the day, what does the above line of code do?
>> I've never seen a C++ construct like that before!
>
> c.f() returns a function pointer or a functor (either one works),
> which is invoked with the parameter x; this function returns another
> function pointer/functor, which is invoked with parameter y; this
> function returns another pointer/functor which is invoked with
parameter z.
>
> Basically, imagine this class:
> class Functor {
> public:
> Functor operator()(int param);
> };
Thanks, I was slowly coming to that conclusion on my own, but since I
had never seen that convention of writing function pointers, I wasn't
really even sure what to Google on.
The C++ class I took only briefly touched on function pointers, and it
never described a member function of a class returning a function
pointer, it only talked about passing a function pointer into a class
member function. I think they specifically did it where the class had a
sort() function, and then we'd write different sorting algorithm
functions (insertion, bubble, heap, etc.) and pass those in to learn
about the speed of different sorting algorithms.
Sean
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator