Multiply the number of characters (given by size()
, or capacity()
if you want to know the total amount allocated rather than the amount in use) by the size of the character type.
If it's std::string
itself, an alias for std::basic_string<char>
, then the character size is one byte, so size()
(or capacity()
) alone will do.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…