简体   繁体   English

如何制作 function 指针的 std::vector?

[英]How can I make a std::vector of function pointers?

I have seen some similar questions but I can't get this to work.我见过一些类似的问题,但我无法解决这个问题。

This fails:这失败了:

std::vector<void (CChristianLifeMinistryEntry::* pfnSetAssignName)(CString)> = xx;

I want a vector so that I can pre-fill it with a series of &CChristianLifeMinistryEntry::SetXXX functions.我想要一个向量,以便我可以用一系列&CChristianLifeMinistryEntry::SetXXX函数预先填充它。 This is so that I can quickly determine the right function to use in a for loop I have.这样我就可以快速确定要在我的for循环中使用的正确 function。

std::vector<void (CChristianLifeMinistryEntry::*)(CString)> pfnSetAssignName = xx;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以有模板函数指针的std :: vector吗? - Can I have a std::vector of template function pointers? 如何制作指向动态分配对象的指针向量? - How can i make a vector of pointers that point to dynamically allocated object? 如何获得从包含 std::function 的向量 std::vector 调用的函数的返回 - How can I get the return of a function called from a vector std::vector that contains std::function 如何在c ++ 11中使用std :: vector使其更快? - How Can I make it faster in c++11 with std::vector? 如何使用std :: shuffle在随机序列中使用唯一指针对向量进行随机排序? - How can I shuffle a vector with unique pointers in a random sequence with std::shuffle? 如何初始化指向操作符重载的函数指针的std :: vector? - How to initialize std::vector of function pointers to operator overloads? 如何为std :: vector专门化模板成员函数<T> - How can I specialize a template member function for std::vector<T> std :: vector :: erase是否会使指针无效? - Does std::vector::erase make pointers invalid? 是否可以将函数指针保留在std :: vector中? - Is it possible to keep function pointers in an std::vector? std :: vector of function指针:不同的模板参数 - std::vector of function pointers: different template parameters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM