ref: update formatting

This commit is contained in:
Katharina 2026-07-02 19:38:45 +02:00
parent 7d0155d8ce
commit 024407225c
16 changed files with 433 additions and 377 deletions

View file

@ -17,7 +17,7 @@ private:
void destroy() {
if (initialized) {
((T*) buffer)->~T();
((T*)buffer)->~T();
initialized = false;
}
}
@ -51,23 +51,24 @@ public:
}
T* operator->() {
return (T*) buffer;
return (T*)buffer;
}
T& operator*() {
return *((T*) buffer);
return *((T*)buffer);
}
const T* operator->() const {
return (const T*) buffer;
return (const T*)buffer;
}
const T& operator*() const {
return *((const T*) buffer);
return *((const T*)buffer);
}
optional& operator=(const optional& other) {
if (this == &other) return *this;
if (this == &other)
return *this;
destroy();
if (other.initialized) {
new (buffer) T(*other);
@ -77,7 +78,8 @@ public:
}
optional& operator=(optional&& other) noexcept {
if (this == &other) return *this;
if (this == &other)
return *this;
destroy();
if (other.initialized) {
new (buffer) T(move(*other));
@ -92,11 +94,11 @@ public:
}
T& value() {
return *((T*) buffer);
return *((T*)buffer);
}
const T& value() const {
return *((const T*) buffer);
return *((const T*)buffer);
}
template<typename Func, typename... ArgT>
@ -119,7 +121,7 @@ public:
const T& value_or(const T& default_value) const {
if (initialized) {
return *((const T*) buffer);
return *((const T*)buffer);
} else {
return default_value;
}