考虑以下代码: 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