The following code does not compile with either Visual Studio2017 or online GDB. I expected it to compile as iterator is just a class with types and it is inherited from publicly. Is this not allowed or doesnt this work in VS2017?
template<typename T>
struct Gen : public std::iterator<std::input_iterator_tag, T>
{
T value;
};
int main()
{
Gen<int> g = Gen<int>{ 10 }; // this doesnt
Gen<int> g2 = Gen<int>{ {}, 10 }; // neither does this
}
The error is
Error C2440 'initializing': cannot convert from 'initializer list' to 'Gen'