I have this:
unsigned short choice;
if(!(valid >> choice))
Ok. My code is almost 1000 lines, and I have splited some functions in headers. But the same function doesn't work:
template <typename T> bool valid_input(const string& input, T var)
return (valid >> var);
You can check it here: http://coliru.stacked-crooked.com/a/0f22981e72360f6f
The output is correct, but in my machine with C++11, MinGW 4.8 (64 bit in a 64bit-Windows8), the output is incorrect. Why?
If you want more specific info, the problem is that I use input, I think. I use std::getline(std::cin, some_string).
Last edited on
Is your program fails on same test you posted on Coliru? Because there should not be errors, and it works with 64bit MinGW GCC 8.8.1 compiler on 64bit Win7.
No, it doesn't. By that I think that the error appears because of the input...
Shouldn't it be
template <typename T> bool valid_input(const string& input, T& var) // <-- T&, not T