s*******t 发帖数: 2896 | 1 看了TCPL的intro部分,太tmd神奇了。
mem_fun() accepts a pointer to a member function of some class as its
arugment, then generates a function that takes an object of that class as
its argument.
that means, a pointer to a member function of some class is in fact not a
pointer to a function, instead, it contains information of both the class
and the member function. | m*****e 发帖数: 4193 | 2 Or we can say it's too complicated. Even such a simple matter would have to
be explained by a book.
【在 s*******t 的大作中提到】 : 看了TCPL的intro部分,太tmd神奇了。 : mem_fun() accepts a pointer to a member function of some class as its : arugment, then generates a function that takes an object of that class as : its argument. : that means, a pointer to a member function of some class is in fact not a : pointer to a function, instead, it contains information of both the class : and the member function.
| o****e 发帖数: 92 | 3 呵呵,没用过 STL 做 functional programming 么
pointer to member function 效率比较低,mem_fun(ptr_fun) 还不如 FunObject()
【在 s*******t 的大作中提到】 : 看了TCPL的intro部分,太tmd神奇了。 : mem_fun() accepts a pointer to a member function of some class as its : arugment, then generates a function that takes an object of that class as : its argument. : that means, a pointer to a member function of some class is in fact not a : pointer to a function, instead, it contains information of both the class : and the member function.
|
|