Does the C++ standard guarantee (either by explicitly stating it or implicitly by logical deduction) that std::uintmax_t
can hold all values of std::size_t
Yes.
size_t
is defined to be an unsigned integer type large enough to contain the size of any object. uintmax_t
is defined to be able to store any value of any unsigned integer type. So if size_t
can store it, uintmax_t
can store it.
Definition of size_t
from C++11 §18.2:
The type size_t is an implementation-defined unsigned integer type that is large enough to contain the size in bytes of any object.
Definition of uintmax_t
from C99 §7.18.1.5 (it is included in C++ by normative reference):
The following type designates an unsigned integer type capable of representing any value of any unsigned integer type:
uintmax_t