| 141 | |
| 142 | template <typename T> |
| 143 | typename std::enable_if<(std::is_same<T, unsigned char>::value || |
| 144 | std::is_same<T, signed char>::value), bool>::type |
| 145 | ConvertStreamTo(std::stringstream& stream, T& rhs) { |
| 146 | int num; |
| 147 | if ((stream >> std::noskipws >> num) && (stream >> std::ws).eof()) { |
| 148 | if (num >= (std::numeric_limits<T>::min)() && |
| 149 | num <= (std::numeric_limits<T>::max)()) { |
| 150 | rhs = static_cast<T>(num); |
| 151 | return true; |
| 152 | } |
| 153 | } |
| 154 | return false; |
| 155 | } |
| 156 | |
| 157 | template <typename T> |
| 158 | typename std::enable_if<!(std::is_same<T, unsigned char>::value || |