Woon-2 / cpp-study

repository for cpp studying

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bu004. mystring.inl에 정의된 operator>> 오류

Lcat12345 opened this issue · comments

오류 목록

image

오류가 뜬 부분 Link

operator>>(std::basic_istream<CharT, Traits>& is,
my_string<CharT>& str)
{
static constexpr std::size_t str_max_size = 1'000'000'000;
using istream_type = std::basic_istream<CharT, Traits>;
using string_type = my_string<CharT>;
using ios_base = typename istream_type::ios_base;
using int_type = typename istream_type::int_type;
using ctype = std::ctype<CharT>;
using ctype_base = typename ctype::ctype_base;
std::size_t extracted = 0;
typename ios_base::iostate err = ios_base::goodbit;
typename istream_type::sentry cerb(is, false);
if (cerb)
{
try
{
// Avoid reallocation for common case.
str.clear();
CharT buf[128];
std::size_t len = 0;
const std::streamsize width = is.width();
const std::size_t n = width > 0 ? width : str_max_size;
const ctype& ct = std::use_facet<ctype>(is.getloc());
const int_type eof = Traits::eof();
int_type c = is.rdbuf()->sgetc();
while (extracted < n
&& !Traits::eq_int_type(c, eof)
&& !ct.is(ctype_base::space,
Traits::to_char_type(c)))
{
if (len == sizeof(buf) / sizeof(CharT))
{
str.append(buf, sizeof(buf) / sizeof(CharT));
len = 0;
}
buf[len++] = Traits::to_char_type(c);
++extracted;
c = is.rdbuf()->snextc();
}
str.append(buf, len);
if (extracted < n && Traits::eq_int_type(c, eof))
err |= ios_base::eofbit;
is.width(0);
}
catch(...)
{
is.setstate(ios_base::badbit);
}
}
if (!extracted)
err |= ios_base::failbit;
if (err)
is.setstate(err);
return is;
}

추가 스크린샷

  • 오류(활성) E0658 템플릿 정의의 닫는 중괄호를 찾을 수 없습니다.

image

  • str_max_size가 정의되어 있지만 정의되지 않았다고 뜸
  • 클래스 템플릿 인수를 추론할수 없음

image

이하 생략

commented

closed by #119