G
g3rc4n
i recently realized you could override global function scope like this
int add(int,int);
double add(double,double);
void f(double a, double b){
int add(int,int); // hides double add(double,double)
double c = add(a,b);
}
but i want to know if you could use it in a struct like this(doesn't
work)
struct foo{
using int add(int,int);
}
becuase i'm sure i could use this feature for something interesting
for metaprogramming like this
template<typename T>
struct impl{
using T add(T,T);
};
template<class T>
struct addition : private impl<T>{
template<class U>
static U add(U a, U b){
return static_cast<U>(add(a,b)); // call T add(T,T)
}
};
thanks in advance
int add(int,int);
double add(double,double);
void f(double a, double b){
int add(int,int); // hides double add(double,double)
double c = add(a,b);
}
but i want to know if you could use it in a struct like this(doesn't
work)
struct foo{
using int add(int,int);
}
becuase i'm sure i could use this feature for something interesting
for metaprogramming like this
template<typename T>
struct impl{
using T add(T,T);
};
template<class T>
struct addition : private impl<T>{
template<class U>
static U add(U a, U b){
return static_cast<U>(add(a,b)); // call T add(T,T)
}
};
thanks in advance