1

Remove readonly restriction from Span

This commit is contained in:
2022-12-08 14:11:02 +01:00
parent f94638be82
commit 6086e33343
2 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,7 @@
namespace Device { namespace Device {
// TODO: Move into class as static members
const IOport CGA::index_port(0x3d4); const IOport CGA::index_port(0x3d4);
const IOport CGA::data_port(0x3d5); const IOport CGA::data_port(0x3d5);

View File

@ -7,7 +7,7 @@
namespace Container { namespace Container {
/** /**
* This class implements a readonly view on a memory region of uniform type * This class implements a view on a continuous memory region of uniform type
* with runtime bounds checking and iterator support. * with runtime bounds checking and iterator support.
* *
* @tparam T The type of the objects located in the memory region * @tparam T The type of the objects located in the memory region
@ -28,9 +28,9 @@ public:
// TODO: Rest of constructors // TODO: Rest of constructors
iterator begin() const { return iterator(ptr); } iterator begin() { return iterator(ptr); }
iterator end() const { return iterator(&ptr[N]); } iterator end() { return iterator(&ptr[N]); }
T *operator[](std::size_t i) const { T *operator[](std::size_t i) const {
if (i >= N) { if (i >= N) {
@ -39,7 +39,7 @@ public:
return &ptr[i]; return &ptr[i];
} }
const T *data() const { return ptr; } T *data() const { return ptr; }
explicit operator T *() const { return ptr; } explicit operator T *() const { return ptr; }
@ -56,7 +56,7 @@ public:
} }
private: private:
const T *const ptr; T *const ptr;
}; };
} // namespace bse } // namespace bse