Использование псевдонимов для шаблонной функции-члена ⇐ C++
-
Гость
Использование псевдонимов для шаблонной функции-члена
I have the following member function in a class
class cls { ... template bool func(...) { // Do something depending on } ... } I want to change func to be private and instead have only the relevant instantiations of func public, e.g something like this
class cls { ... private: template bool func(...) { // Do something depending on } ... public: func_foo = func; func_bar = func; ... } so I could do
cls c; ... c.func_foo(...); I know I can do something like
bool func_bar(...) { return func(...); } But this is kinda ugly, wondering if there is a better way to do this
Источник: https://stackoverflow.com/questions/781 ... r-function
I have the following member function in a class
class cls { ... template bool func(...) { // Do something depending on } ... } I want to change func to be private and instead have only the relevant instantiations of func public, e.g something like this
class cls { ... private: template bool func(...) { // Do something depending on } ... public: func_foo = func; func_bar = func; ... } so I could do
cls c; ... c.func_foo(...); I know I can do something like
bool func_bar(...) { return func(...); } But this is kinda ugly, wondering if there is a better way to do this
Источник: https://stackoverflow.com/questions/781 ... r-function
Мобильная версия