mam ten kod:decltype dla przeciążonej funkcji członka
struct Foo
{
int print(int a, double b);
int print(int a);
void print();
void print(int a, int b, int c);
void other();
};
mogę zadzwonić
decltype(&Foo::other)
ale wzywającą
decltype(&Foo::print)
koniec z błędem, co jest dla mnie jasne.
Ale jak mogę bardziej dokładnie określić, która z czterech metod print
, chcę rozwiązać na decltype
?
chcę dalej korzystać z tego w
template <class MT>
struct method_info;
template <class T, class Res, class... Args>
struct method_info<Res(T::*)(Args...)>
{
typedef std::tuple<Args&&...> args_tuple;
typedef T ClassType;
typedef Res RetVal;
};
template <class MethodType>
void func() {
typedef method_info<MethodType> MethodInfo;
.....
}
func<decltype(&Foo::other)>();
....
Co masz na myśli mówiąc "bardziej" bliżej "*? Jeśli funkcja jest przeciążona, musisz dokładnie określić, która wersja ma być używana. – NathanOliver
Czy jest to adres [odniesienie] (http://pl.cppreference.com/w/cpp/language/overloaded_address), którego szukasz? – UKMonkey