util/HugeAllocator: add noexcept
This commit is contained in:
parent
faee5bbb78
commit
cb49a03fd7
@ -153,17 +153,17 @@ public:
|
|||||||
explicit HugeArray(size_type _size)
|
explicit HugeArray(size_type _size)
|
||||||
:buffer(Buffer::FromVoidFloor(HugeAllocate(sizeof(value_type) * _size))) {}
|
:buffer(Buffer::FromVoidFloor(HugeAllocate(sizeof(value_type) * _size))) {}
|
||||||
|
|
||||||
constexpr HugeArray(HugeArray &&other)
|
constexpr HugeArray(HugeArray &&other) noexcept
|
||||||
:buffer(std::exchange(other.buffer, nullptr)) {}
|
:buffer(std::exchange(other.buffer, nullptr)) {}
|
||||||
|
|
||||||
~HugeArray() {
|
~HugeArray() noexcept {
|
||||||
if (buffer != nullptr) {
|
if (buffer != nullptr) {
|
||||||
auto v = buffer.ToVoid();
|
auto v = buffer.ToVoid();
|
||||||
HugeFree(v.data, v.size);
|
HugeFree(v.data, v.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HugeArray &operator=(HugeArray &&other) {
|
HugeArray &operator=(HugeArray &&other) noexcept {
|
||||||
std::swap(buffer, other.buffer);
|
std::swap(buffer, other.buffer);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -178,64 +178,64 @@ public:
|
|||||||
HugeDiscard(v.data, v.size);
|
HugeDiscard(v.data, v.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(std::nullptr_t) const {
|
constexpr bool operator==(std::nullptr_t) const noexcept {
|
||||||
return buffer == nullptr;
|
return buffer == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(std::nullptr_t) const {
|
constexpr bool operator!=(std::nullptr_t) const noexcept {
|
||||||
return buffer != nullptr;
|
return buffer != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of allocated elements.
|
* Returns the number of allocated elements.
|
||||||
*/
|
*/
|
||||||
constexpr size_type size() const {
|
constexpr size_type size() const noexcept {
|
||||||
return buffer.size;
|
return buffer.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference front() {
|
reference front() noexcept {
|
||||||
return buffer.front();
|
return buffer.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference front() const {
|
const_reference front() const noexcept {
|
||||||
return buffer.front();
|
return buffer.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
reference back() {
|
reference back() noexcept {
|
||||||
return buffer.back();
|
return buffer.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference back() const {
|
const_reference back() const noexcept {
|
||||||
return buffer.back();
|
return buffer.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one element. No bounds checking.
|
* Returns one element. No bounds checking.
|
||||||
*/
|
*/
|
||||||
reference operator[](size_type i) {
|
reference operator[](size_type i) noexcept {
|
||||||
return buffer[i];
|
return buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one constant element. No bounds checking.
|
* Returns one constant element. No bounds checking.
|
||||||
*/
|
*/
|
||||||
const_reference operator[](size_type i) const {
|
const_reference operator[](size_type i) const noexcept {
|
||||||
return buffer[i];
|
return buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator begin() {
|
iterator begin() noexcept {
|
||||||
return buffer.begin();
|
return buffer.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const_iterator begin() const {
|
constexpr const_iterator begin() const noexcept {
|
||||||
return buffer.cbegin();
|
return buffer.cbegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator end() {
|
iterator end() noexcept {
|
||||||
return buffer.end();
|
return buffer.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const_iterator end() const {
|
constexpr const_iterator end() const noexcept {
|
||||||
return buffer.cend();
|
return buffer.cend();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user