Having read several answers on SO (e.g. here and here), I figured out the two usual alternatives for calling a function template in a template base:
template<typename T>
struct Base
{
    template<int N>
    auto get() const
    {
        return N;   
    }
};
template<typename T>
struct Derived : public Base<T>
{
    //first alternative
    auto f0() const { return this-> template get<0>(); }   
    //second alternative
    auto f1() const { return Base<T>::template get<1>(); }    
};
DEMO
But is there also an equivalent to the using Base<T>::foo declaration for non-template functions? Maybe something like
template<int N>
using Base<T>::template get<N>;  //does not compile in gcc
                As an alternative to using you might redeclare the function with something like:
template<int N> auto get() const{ return Base<T>::template get<N>(); }
This code works with VS2015, but not with coliru:
using Base<T>::template get;
template<int N>
auto f3() { return get<N>(); }
From my understanding after reading the commenty by T.C. this is a custom extension of VS2015 and the behaviour is not part of the standard and might even be considered as ill-formed.
I wasn't able to get it to work with your using either. However, if the intent is to simplify the cumbersome invocation syntax, then you might find the following alternative useful. I think it gives a similar effect.
template<typename T> 
struct Base 
{ 
    template<int N> 
    auto get() const 
    { 
        return N;    
    } 
}; 
template<typename T> 
struct Derived : public Base<T> 
{ 
    auto f0() const  
    {  
        auto get_0 = Base<T>::template get<0>; 
        get_0(); 
    }    
    //second alternative 
    auto f1() const  
    {  
        auto get_1 = Base<T>::template get<1>; 
        get_1(); 
    }     
}; 
int main() 
{ 
    return 0; 
} 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With