考慮以下代碼: struct AA
{
int& rr;
};
有沒有辦法獲得指針(或者引用)AA::rr爲了獲得這個? AA* aa;
auto mm = &AA::rr; // error: cannot create pointer to reference member ‘AA::rr’
aa ->* mm;
而且在gcc-7.0.1decltype(AA::mm
即: [](auto const& foo) {
??? bar; // should be same base type as foo, minus const&
}
到目前爲止,我使用的是: typename std::remove_const<typename std::remove_reference<decltype(foo)>::type>::type combinat