I have created a template as follows
template<typename T>
void f(T const& t) { }
I wanted for this to be callable by containers but also by initializer lists. I thought it would be initializer_list<int>
, when called as follows.
f({1, 2, 3});
But GCC behaves as if it's not Standards compliant
m.cpp: In function 'int main()':
m.cpp:6:25: warning: deducing 'const T' as 'const std::initializer_list<int>'
m.cpp:4:6: warning: in call to 'void f(const T&) [with T = std::initializer_list<int>]'
m.cpp:6:25: warning: (you can disable this with -fno-deduce-init-list)
Can anyone explain how I can make this work without warnings? Thanks!