由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - about STL functor and function pointers
相关主题
function pointer 和 call-back function 有什么区别?c++太神奇了
把一个function pointer作为参数传入一个function的语法是什么?Question: Given a pointer to a function
access function static variablea c++ question
C++的smart pointer注定是个二流的东西pointer to function
C++ template Questions (转载)can you insert several function pointers into a queue ?
Haskell很难学。。c++ question
c的函数指针能不能弄得像matlab的function handle一样?听说pointer to member function只支持最多128个virtual functi
pointer to override function?C++ Function Pointer Array 的问题
相关话题的讨论汇总
话题: stl话题: functor话题: function话题: expecting话题: pointers
进入Programming版参与讨论
1 (共1页)
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?

1 (共1页)
进入Programming版参与讨论
相关主题
C++ Function Pointer Array 的问题C++ template Questions (转载)
关于Function Pointer的简单问题,望指教Haskell很难学。。
function in c++c的函数指针能不能弄得像matlab的function handle一样?
C++ Q90 - Q92 (转载)pointer to override function?
function pointer 和 call-back function 有什么区别?c++太神奇了
把一个function pointer作为参数传入一个function的语法是什么?Question: Given a pointer to a function
access function static variablea c++ question
C++的smart pointer注定是个二流的东西pointer to function
相关话题的讨论汇总
话题: stl话题: functor话题: function话题: expecting话题: pointers