mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 04:24:37 +03:00
Added begin()/end() + operator[] to CodeBuffer
This commit is contained in:
@@ -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; }
|
||||||
|
|
||||||
|
//! \}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user