I'm using a C++ library (strf) which, somewhere within it, has the following code:
namespace strf {
template <typename ForwardIt>
inline auto range(ForwardIt begin, ForwardIt end) { /* ... */ }
template <typename Range, typename CharT>
inline auto range(const Range& range, const CharT* sep) { /* ... */ }
}
Now, I want to use strf::range<const char*>(some_char_ptr, some_char_ptr + some_length)
in my code. But if I do so, I get the following error (with CUDA 10.1's NVCC):
error: more than one instance of overloaded function "strf::range" matches the argument list:
function template "auto strf::range(ForwardIt, ForwardIt)"
function template "auto strf::range(const Range &, const CharT *)"
argument types are: (util::constexpr_string::const_iterator, util::constexpr_string::const_iterator)
The library code can probably be changed to avoid this (e.g. using:
inline auto range(const typename std::enable_if<not std::is_pointer<typename std::remove_cv<Range>::type>::value, Range &>::type range, const CharT* sep)
to ensure Range
is not a pointer); but I can't make that change right now. Instead, I want to somehow indicate to the compiler that I really really mean to only have one template argument, not one specified and another one deduced.
Can I do that?
Would appreciate answers for C++11 and C++14; C++17 answers involving deduction guides are less relevant but if you have one, please post it (for future NVCC versions...)
Update: The strf library itself has been updated to circumvent this situation, but the question stands as asked.