Mooophy / Cpp-Primer

C++ Primer 5 answers
Creative Commons Zero v1.0 Universal
8.11k stars 3k forks source link

ex13.44 about size and length function #813

Open relaxcn opened 2 years ago

relaxcn commented 2 years ago

in the ex13_44_47.h, the size and length function is different.

size_t size() const { return end - elements; }
size_t length() const { return end - elements - 1; }

But this website says that they return the same value, they are synonyms.

lvchong-del commented 2 years ago

maybe minus the terminating null character '\0'?