I want to make a custom char_traits
class for my own type. I have declared all the functions, but I am having some confusion regarding vague semantics given in the standard.
What are
fpos_type
,off_type
andstate_type
expected to do? Where are they required, if at all?Standard says to keep
traits::eof()
and valid code points separate and thus asks to use anint_type
which is bigger than thechar_type
. But can I then make mychar_type
as a signed number where I know valid code points are only in the non-negative range. It leaves me with negative values as possible values oftraits::eof()
. Or should it be thatint_type
should be a proper superset ofchar_type
so that nochar_type
can ever take the value ofeof()
? Being more to the point, can I makeint_type
andchar_type
to be same?