#include <iostream>
template<typename T, int (T::*M)>
int getValue(T const& obj)
{
return obj.*M;
}
class NotPlainOldDataType
{
public:
explicit NotPlainOldDataType(int xx) : x(xx) { }
~NotPlainOldDataType() { }
int x;
};
int main()
{
typedef NotPlainOldDataType NPOD;
NPOD obj(3);
std::cout << getValue<NPOD, &NPOD::x>(obj) << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGU8dHlwZW5hbWUgVCwgaW50IChUOjoqTSk+CmludCBnZXRWYWx1ZShUIGNvbnN0JiBvYmopCnsKICAgIHJldHVybiBvYmouKk07Cn0KCmNsYXNzIE5vdFBsYWluT2xkRGF0YVR5cGUKewpwdWJsaWM6CiAgICBleHBsaWNpdCBOb3RQbGFpbk9sZERhdGFUeXBlKGludCB4eCkgOiB4KHh4KSB7IH0KICAgIH5Ob3RQbGFpbk9sZERhdGFUeXBlKCkgeyB9CiAgICBpbnQgeDsKfTsKCmludCBtYWluKCkKewogICAgdHlwZWRlZiBOb3RQbGFpbk9sZERhdGFUeXBlIE5QT0Q7CgogICAgTlBPRCBvYmooMyk7CiAgICBzdGQ6OmNvdXQgPDwgZ2V0VmFsdWU8TlBPRCwgJk5QT0Q6Ong+KG9iaikgPDwgJ1xuJzsKfQ==