Search code examples
c++operator-overloadingcrypto++

Why Crypto++ SecByteBlock subscripting works


I'm trying to understand why following code using Crypto++ SecByteBlock works:

SecByteBlock block(10);
std::cout << block[3];

It's like SecByteBlock has an subscript (operator[]) but I can't find it (version 8.2.0, but not present in older versions too). I'm compiling with C++14. Any ideas?


Solution

  • That type has a conversion to (const) byte *, which is then used as a basis for indexing.