Start working on a VFS implementation #22

Closed
apio wants to merge 44 commits from oop-vfs into main
Showing only changes of commit 6eff41e7af - Show all commits

View File

@ -138,26 +138,16 @@ template <typename T> class Option
private: private:
struct Storage struct Storage
{ {
u8 buffer[sizeof(T)]; alignas(T) u8 buffer[sizeof(T)];
T* fetch_ptr()
{
return (T*)buffer;
}
T& fetch_reference() T& fetch_reference()
{ {
return *fetch_ptr(); return *__builtin_launder(reinterpret_cast<T*>(&buffer));
}
const T* fetch_ptr() const
{
return (const T*)buffer;
} }
const T& fetch_reference() const const T& fetch_reference() const
{ {
return *fetch_ptr(); return *__builtin_launder(reinterpret_cast<const T*>(&buffer));
} }
void store_reference(const T& ref) void store_reference(const T& ref)