Created
March 15, 2020 01:43
-
-
Save vinniefalco/29b92a4d4ce9d63fa85b19ef0c4f8ea5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class char_stream | |
{ | |
char const* p_; | |
char const* end_; | |
public: | |
char_stream( | |
char const* begin, | |
char const* end) | |
: p_(begin) | |
, end_(end) | |
{ | |
} | |
bool | |
empty() const noexcept | |
{ | |
return p_ == end_; | |
} | |
char | |
peek() const noexcept | |
{ | |
if(BOOST_JSON_LIKELY(p_ < end_)) | |
return *p_; | |
return '\0'; | |
} | |
char | |
get() const noexcept | |
{ | |
if(BOOST_JSON_LIKELY(p_ < end_)) | |
return *p_++; | |
return '\0'; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment