w******g 发帖数: 67 | 1 "Question about C functions calling C++ STL - can we C structs typecasted
into C++ containers (asked some specifics here)"
Call C functions call STL function?
Actually, this is from someone's interviewing one headhunter sent to you.
So it maybe just part of original question. Any idea, reference or
discussion is welcome.
Thanks a lot. |
E*V 发帖数: 17544 | 2 are you asking " can C call c++ stl functions?"
if so, yes
【在 w******g 的大作中提到】 : "Question about C functions calling C++ STL - can we C structs typecasted : into C++ containers (asked some specifics here)" : Call C functions call STL function? : Actually, this is from someone's interviewing one headhunter sent to you. : So it maybe just part of original question. Any idea, reference or : discussion is welcome. : Thanks a lot.
|
w******g 发帖数: 67 | 3 Could you give more details, examples or any references?Cannot find good
posts on Google. Thanks. |
w******g 发帖数: 67 | 4 我觉得题目的意思可能是:
1. C 程序能不能调用 STL 库函数
2. 如果可以, 能不能把C程序中定义的struct 作为变量传给 STL 函数。
比如,我在C程序中定义了一个struct list(或者是array of struct), 能不能调用STL
中的标准函数(像:sort,find),把C程序中的list(或者是array of struct)作为
参数传给sort 或者 find?或者在什么情况下可以传递呢?
如果理解的不对,请指教。 |
k*******d 发帖数: 1340 | 5 Even if you are using C compiler???
【在 E*V 的大作中提到】 : are you asking " can C call c++ stl functions?" : if so, yes
|
d****p 发帖数: 685 | 6 1. Calling STL stuff from C code
Yes you can if the C code will be compiled in C++.
2. Probably not since normally real C structs are not copible/assignable in
C++ perspective (no copy ctor/assignment operator) and hence don't fit STL
container requirement. If these structs are POD then that's another story.
【在 w******g 的大作中提到】 : "Question about C functions calling C++ STL - can we C structs typecasted : into C++ containers (asked some specifics here)" : Call C functions call STL function? : Actually, this is from someone's interviewing one headhunter sent to you. : So it maybe just part of original question. Any idea, reference or : discussion is welcome. : Thanks a lot.
|