H*M 发帖数: 1268 | 1 studying STL now and have a question.
it seems to me that:
1. in STL, if a function is expecting a functor, it is usually ok to use fun
ction pointer; even if it is not ok, you still can use ptr_fun to get an obj
ect;
2. if it is expecting a function pointer, you can not use a functor, like qs
ort.
From what I read, most STL functions are expecting functors. Who can sumariz
e which functions are expecting function pointers only(e.g. qsort)? Or where
can I find such info.? many thanks. | t****t 发帖数: 6806 | 2 qsort is not a part of STL. STL is standard template library. qsort is not
template... | H*M 发帖数: 1268 | 3 yeah sorry my mistake
it is in cstdlib
can I conculde that all STL functions are fine with functors, and some are f
ine with function pointers at the same time?
【在 t****t 的大作中提到】 : qsort is not a part of STL. STL is standard template library. qsort is not : template...
| z***e 发帖数: 5393 | 4 almost right.
c++ programming language上说stl function只是指望你给的那个能够执行 operator(
) (...)的运算,不管是function pointer还是functor.
f
【在 H*M 的大作中提到】 : yeah sorry my mistake : it is in cstdlib : can I conculde that all STL functions are fine with functors, and some are f : ine with function pointers at the same time?
|
|