It's possible to construct a vector with an iterator range, like this:
std::vector<std::string> vec(std::istream_iterator<std::string>{std::cin},
std::istream_iterator<std::string>{});
But I can also compile and run code using C++11 uniform initialization syntax (note the bracers), like this:
std::vector<std::string> vec{std::istream_iterator<std::string>{std::cin},
std::istream_iterator<std::string>{}};
What's really going on here?
I know that a constructor taking an initializer list gets priority over other forms of construction. Shouldn't the compiler resolve to the constructor taking an initializer list containing 2 elements of std::istream_iterator? This should be an error as a std::istream_iterator can't be converted to the vectors value type std::string, right?