I have a question regarding partial specialisation of templated member functions.
Background: The goal is to compute descriptive statistics of larg
As commented, you don't need to use partial specialization for this at all, indeed partial specialization is usually pretty easy to avoid, and preferred to avoid.
private:
template
struct tag{}; // trivial nested struct
template
void push_impl(I first, I last, tag) { ... } // generic implementation
template
void push_impl(I first, I last, tag>) { ... } // complex implementation
public:
template
void push(InputIt first, InputIt last)
{
push_impl(first, last,
tag::value_type> {});
}
Since push_impl
is a (private) member function you don't need to do anything special any more.
Compared to your proposed solutions, this has no extra performance cost. It's the same number of function calls, the only difference is passing a stateless type by value, which is a wholly trivial optimization for the compiler. And there's no sacrifice in encapsulation either. And slightly less boilerplate.