Closed stgeke closed 11 months ago
length
does: https://github.com/libocca/occa/blob/main/src/core/memory.cpp#L145. It's distinguished from size
in this way.
I know but I would prefer a std::vector conform behaviour. IMHO, it's less error-prone.
Why would memory
need to behave like std::vector
? A vector does not have a way to get it's memory footprint, it is just an implementation of a container, where the user can only do operations on elements, not bytes.
The array
class in OCCA is more like std::vector
. That does have an []
indexing operator for example. To me the least error prone approach is to keep each class concerned with its own use case and don't muddle things by overlapping functionality between memory
and array
too much.
Having in mind that occa::memory
is dtype aware all methods should reflect that. May be memory::size()
is an exception and returns always the number of bytes.
To make it consistent with STL functions like
std::vector
.