Just like the title asks, can C++ class templates take method names as template parameters?
For instance,
template <T>
class Foo
{
public:
void T(int bar);
};
Unfortunately, the C++ core language does not have any means of handling names .
Some possibilities:
For those who wonder, what does one need this for?, a case in point is how to something like Python's library "named tuple" class, in C++, where the programmer provides the names of the tuple members.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.