'Template template deduction failed in MSVC (compiling on GCC/Clang)
I've written a template function whose template arguments are being correctly deduced by GCC/Clang but are ambiguous to MSVC.
Here is a compiler explorer link: https://godbolt.org/z/8b376EYYr
The template is declared as:
template <typename Int = int, template <typename...> typename Cont = std::vector>
Cont<Int> input_to_int(Cont<std::string> input);
and it is used in main():
std::vector<int> int_vec = input_to_int(str_vec);
The error message is:
<source>(36): error C2672: 'input_to_int': no matching overloaded function found
<source>(36): error C2784: 'Cont<Int> input_to_int(Cont<std::string>)': could not deduce template argument for 'Cont<std::string>' from 'std::vector<std::string,std::allocator<std::string>>'
Is the issue related to the missing allocator parameter for std::string?
Could someone help me to get it compiling with all three compilers?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
