mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add std container compatibility to MemoryBlock
This commit is contained in:
@@ -72,6 +72,14 @@ public:
|
||||
MemoryBlock& operator= (MemoryBlock&& other) noexcept;
|
||||
#endif
|
||||
|
||||
// Standard container interface
|
||||
typedef char* iterator;
|
||||
typedef char const* const_iterator;
|
||||
inline iterator begin () noexcept { return static_cast <iterator> (getData ()); }
|
||||
inline iterator end () noexcept { return addBytesToPointer (begin (), size); }
|
||||
inline const_iterator cbegin () const noexcept { return static_cast <const_iterator> (getData ()); }
|
||||
inline const_iterator cend () const noexcept { return addBytesToPointer (cbegin (), size); }
|
||||
|
||||
//==============================================================================
|
||||
/** Compares two memory blocks.
|
||||
|
||||
@@ -104,7 +112,6 @@ public:
|
||||
template <typename Type>
|
||||
char& operator[] (const Type offset) const noexcept { return data [offset]; }
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the block's current allocated size, in bytes. */
|
||||
size_t getSize() const noexcept { return size; }
|
||||
|
||||
Reference in New Issue
Block a user