Использование псевдонимов для шаблонной функции-членаC++

Программы на 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

Вернуться в «C++»