why does the following code generate a "reference to 'tm' is ambiguous" error?

#include <iostream> using namespace std; namespace characters { char tm=’a’; char tc=’a’; } using namespace characters; class table { public: void printline (){ char m; m=tm; //m=tc; cout<<m<<m<<m<<m<<m<<m<<m<<m<<m; } }; int main() { table myTable; myTable.printline(); return 0; } but when you comment out the m=tm; line and reinstate the line m=tc the code works… Read More why does the following code generate a "reference to 'tm' is ambiguous" error?

Why were parentheses disambiguated as a function declaration with std::istream_iterator?

auto queue = [](string str) { istringstream ss(str); //std::copy(std::istream_iterator<string>(ss), // std::istream_iterator<string>(), // std::ostream_iterator<string>(std::cout, " ")); //deque<string> q(std::istream_iterator<string>(ss), std::istream_iterator<string>{}); deque<string> q(std::istream_iterator<string>(ss), std::istream_iterator<string>()); return q; }; Why would the compiler complain parentheses were disambiguated as a function declaration [-Wvexing-parse] if I construct a container with istream_iterator<string>(). Is there any difference with parameters in std::copy and container constructor?… Read More Why were parentheses disambiguated as a function declaration with std::istream_iterator?