How to combine template partial specialization and template argument deduction
Posted
by
KKKoo0
on Stack Overflow
See other posts from Stack Overflow
or by KKKoo0
Published on 2013-11-06T15:16:01Z
Indexed on
2013/11/06
15:53 UTC
Read the original article
Hit count: 348
My understanding is that template argument deduction is only for function templates, but function templates does not allow partial specialization. Is there a way to achieve both?
I basically want to achieve a function-like object (can be a functor) with the signature
template<class InputIterator1, class InputIterator2, class OutputIterator, int distribution>
void GetQuantity(InputIterator1 frist1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, double supply, double limit);
Depending on the value of distribution, I want to have a couple of specializations of this template. And when I call this function,I basically do not want to specify all the type parameters, because they are many of them (and thus I need argument deduction)!
© Stack Overflow or respective owner