I have a question on the implementation of vector in EASTL
.
The link is here.
Namely, on the method size()
. Here is what it looks like:
template <typename T, typename Allocator>
inline typename vector<T, Allocator>::size_type
vector<T, Allocator>::size() const
{
return (size_type)(mpEnd - mpBegin);
}
size_type
is uint32_t
, mpBegin
/mpEnd
are T* pointers.
I do not understand how the cast to uint32_t from (mpEnd - mpBegin) equals the number of elements in a vector. Shouldn't it be divided by sizeof(T)
? Otherwise we just get the size in bytes of all the elements in the vector?
What am I missing?
EDIT: Unless, the EASTL vector dosn't follow the stl defintion of a vector, but I couldn't find any data on it and its supposedly be possible to replace stl vector with eastl vector