【发布时间】:2016-04-08 15:04:36
【问题描述】:
我有一堂课:
class A
{
// ...
public:
std::string s;
// ...
}
还有一个功能:
void some_process(RandomIt first, RandomIt last)
{
static_assert(/* some check if *RandomIt has member with name `s` */,
"Iterator must point to an object with member `s`");
// further process using RandomIt and using *RandomIt.s
}
如何在 C++ 到 C++17 的情况下实现此检查?
【问题讨论】:
标签: templates c++11 c++14 typetraits c++17