I’m trying to bring a function into consideration with a using declaration:
namespace n {
struct S {};
bool equal(S a, S b, std::vector<int> = {1,2}) { return false; }
}
int main() {
using ::n::equal;
using ::n::S;
/// ...
}
This works well as long as no std::initializer_list
is passed as the third argument
equal(S{},S{});
equal(S{},S{},{1});
but breaks when a std::initializer_list
is passed as the third argument
equal(S{},S{},std::initializer_list<int> {1, 2});
and only considers std::equal
.
I struggle to understand the reason why this is not working and to find a solution to enable this pattern.
live demo