c++ - same function Multiple Names without Wrappers -


i creating small linear algebra library educational purposes.

i have function called . these function doing mathematical operations , , given different names different communities. 1 name machine learning people(say a) , name statistics people(say b).

i want both of them able access function using different names use , ie both a(...) , b(...) should give same result. obvious way use function wrapper.

b(...) {    return a(...) }   

this job done. right way ? there better more "elegant" way ?

-thank

you use function pointers.

int f1(int a) {     return * 2; }  const auto f2 = f1;  int main() {     cout << f2(4) << endl; } 

Popular posts from this blog