Код: Выделить всё
// api.h
struct Api {
int foo(int c);
int bar(int a, int b);
};
Код: Выделить всё
// api users
struct InApi : Api {
int memfoo() {
return bar(2, foo(5));
}
};
int extfoo(Api * api) {
return api->bar(2, api->foo(5));
}
Код: Выделить всё
// outside of Api class, but as if in
int desiredFormat = [/*capture implicit this context*/](Api *)->{
return bar(2, foo(5)); // no this-> required to resolve
}(api);
И если возможно , возникнут ли какие-либо потенциальные сложности при выполнении этого в двоично-совместимых динамических библиотеках, загружаемых одним и тем же процессом?
Подробнее здесь: https://stackoverflow.com/questions/793 ... -scope-acr
Мобильная версия