#include <vector>
class A {
public:
A() {}
};
template<typename T>
void foo(const T &p) {
static_assert(
std::is_pod<
typename std::remove_reference<
decltype(p[0])
>::type
>::value, "MUST BE POD");
}
int main() {
int b[10];
A c[10];
int *d = b;
A *e = c;
foo(std::vector<int>(1)); // OK
foo(b); // OK
foo(d); // OK
// foo(std::vector<A>(1)); // ERROR
// foo(c); // ERROR
// foo(e); // ERROR
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KY2xhc3MgQSB7CiBwdWJsaWM6CiAgQSgpIHt9Cn07Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBUPgp2b2lkIGZvbyhjb25zdCBUICZwKSB7CiAgc3RhdGljX2Fzc2VydCgKICAgIHN0ZDo6aXNfcG9kPAogICAgICAgIHR5cGVuYW1lIHN0ZDo6cmVtb3ZlX3JlZmVyZW5jZTwKICAgICAgICAgIGRlY2x0eXBlKHBbMF0pCiAgICAgICAgPjo6dHlwZQogICAgPjo6dmFsdWUsICJNVVNUIEJFIFBPRCIpOwp9CmludCBtYWluKCkgewogIGludCBiWzEwXTsKICBBICAgY1sxMF07CiAgaW50ICpkID0gYjsKICBBICAgKmUgPSBjOwoKICBmb28oc3RkOjp2ZWN0b3I8aW50PigxKSk7IC8vIE9LCiAgZm9vKGIpOyAgICAgICAgICAgICAgICAgICAvLyBPSwogIGZvbyhkKTsgICAgICAgICAgICAgICAgICAgLy8gT0sKLy8gIGZvbyhzdGQ6OnZlY3RvcjxBPigxKSk7ICAgLy8gRVJST1IKLy8gIGZvbyhjKTsgICAgICAgICAgICAgICAgICAgLy8gRVJST1IKLy8gIGZvbyhlKTsgICAgICAgICAgICAgICAgICAgLy8gRVJST1IKICByZXR1cm4gMDsKfQ==