标签:arp oca template bsp pre null c++ control one
直接上代码
void Add(int a, double b, short c, const char * f) { std::cout << f << a << ", " << b << ", " << c << ";\n"; } void *p = nullptr; template <typename ... Args> void CallLater(Args... args) { auto c = std::make_tuple(args...); auto ptuple = new decltype(c); *ptuple = c; p = (void *)ptuple; } void doCall(){ using v = std::tuple<int , double , short , const char * >; v * ptuple = static_cast<v *>(p); std::apply(Add, *ptuple); delete ptuple; p = nullptr; } void main() { CallLater(1, 3.5, (short)3, "this"); doCall(); }
标签:arp oca template bsp pre null c++ control one
原文地址:https://www.cnblogs.com/arnorld/p/14849218.html