Added begin()/end() + operator[] to CodeBuffer

This commit is contained in:
kobalicek
2020-02-14 00:08:47 +01:00
parent 0ee535519c
commit 8e1eb4f5dc

View File

@@ -115,6 +115,21 @@ struct CodeBuffer {
kFlagIsFixed = 0x00000002u kFlagIsFixed = 0x00000002u
}; };
//! \name Overloaded Operators
//! \{
inline uint8_t& operator[](size_t index) noexcept {
ASMJIT_ASSERT(index < _size);
return _data[index];
}
inline const uint8_t& operator[](size_t index) const noexcept {
ASMJIT_ASSERT(index < _size);
return _data[index];
}
//! \}
//! \name Accessors //! \name Accessors
//! \{ //! \{
@@ -133,6 +148,17 @@ struct CodeBuffer {
inline size_t capacity() const noexcept { return _capacity; } inline size_t capacity() const noexcept { return _capacity; }
//! \} //! \}
//! \name Iterators
//! \{
inline uint8_t* begin() noexcept { return _data; }
inline const uint8_t* begin() const noexcept { return _data; }
inline uint8_t* end() noexcept { return _data + _size; }
inline const uint8_t* end() const noexcept { return _data + _size; }
//! \}
}; };
// ============================================================================ // ============================================================================