What exactly is std::iostream::pos_type?

http://ideone.com/V5kx2p
6
7
8
9
std::cout << sizeof(long long) << std::endl;
std::cout << sizeof(long double) << std::endl;
std::cout << sizeof(std::iostream::pos_type) << std::endl;
std::cout << typeid(std::iostream::pos_type).name() << std::endl;
8
12
16
St4fposI11__mbstate_tE
OK, so it's obviously not a primitive type, but could it be? Are all those 16 bytes actually used? If so, that's pretty darn future proof, as there isn't even a unit of measure suitable enough to represent the maximum file size - it's 3.4E14 yottabytes.

What does the standard say you should be able to do with a pos_type? Can you treat it like an integral primitive?
It's std::fpos<std::mbstate_t>, and it's not just offset, it's also the state of the parser, see http://en.cppreference.com/w/cpp/io/fpos
Last edited on
Topic archived. No new replies allowed.