elliotgoodrich / SSO-23

Memory optimal Small String Optimization implementation for C++
233 stars 8 forks source link

Incorrect use of operator& in README.md #4

Open a-p-jo opened 2 years ago

a-p-jo commented 2 years ago

All over the README.md file, there is code like :

CharT *data() {
    return (m_capacity > buffer_size) ? m_data.ptr : &m_data.buffer;
}

Note that while the type of m_data.ptr is indeed CharT *, that of &m_data.buffer is CharT **, because the "name" of an array decays to a pointer to it's 0th element.

Either you want m_data.buffer or you want &m_data.buffer[0] (the latter seems be the idiom in some C++ code, for instance in A Tour of C++ By Bjarne himself).

I hope this error does not exist in the source code.