std::istream/std::streambuf use std::char_traits ::to_int_type, to ensure that std::char_traits ::eof() and the character 0xFF do not end up as the same value, eg. 0xFFFFFFFF.
| 4821 | // ensure that std::char_traits<char>::eof() and the character 0xFF do not |
| 4822 | // end up as the same value, eg. 0xFFFFFFFF. |
| 4823 | std::char_traits<char>::int_type get_character() |
| 4824 | { |
| 4825 | auto res = sb->sbumpc(); |
| 4826 | // set eof manually, as we don't use the istream interface. |
| 4827 | if (JSON_HEDLEY_UNLIKELY(res == EOF)) |
| 4828 | { |
| 4829 | is->clear(is->rdstate() | std::ios::eofbit); |
| 4830 | } |
| 4831 | return res; |
| 4832 | } |
| 4833 | |
| 4834 | private: |
| 4835 | /// the associated input stream |