14 : begin_(data), end_(data + size), current_(data) {}
17 int_type underflow() final {
18 if (current_ == end_) {
19 return traits_type::eof();
21 return traits_type::to_int_type(*current_);
24 int_type uflow() final {
25 if (current_ == end_) {
26 return traits_type::eof();
28 return traits_type::to_int_type(*current_++);
31 int_type pbackfail(int_type ch)
final {
32 if (current_ == begin_ || (ch != traits_type::eof() && ch != current_[-1])) {
33 return traits_type::eof();
35 return traits_type::to_int_type(*--current_);
38 std::streamsize showmanyc() final {
39 return end_ - current_;
42 pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode)
final {
43 if (dir == std::ios_base::beg) current_ =
std::min(begin_ + off, end_);
44 else if (dir == std::ios_base::cur) current_ =
std::min(current_ + off, end_);
45 else current_ =
std::max(end_ - off, begin_);
46 return {off_type(current_ - begin_)};
49 char const *
const begin_;
50 char const *
const end_;
51 char const * current_;
CharArrayBuffer(char const *data, std::size_t size)
std::enable_if_t< std::is_integral_v< T >, T > max(T a, T b)
std::enable_if_t< std::is_integral_v< T >, T > min(T a, T b)