Added operators to BoxedObject, fixed MappintIterator for reference types and fixed signature of custom assertion and error handlers.

This commit is contained in:
2023-11-12 15:25:46 +01:00
parent 2cc0f74d06
commit 7c1dd29a85
4 changed files with 24 additions and 18 deletions

View File

@@ -32,13 +32,14 @@ class BoxedObject
{
private:
union {
std::byte placeholder_;
T object_;
};
#if MIJIN_BOXED_OBJECT_DEBUG
bool constructed = false;
#endif
public:
BoxedObject() = default;
BoxedObject() noexcept : placeholder_() {};
explicit BoxedObject(T object)
#if MIJIN_BOXED_OBJECT_DEBUG
: constructed(true)
@@ -59,6 +60,11 @@ public:
BoxedObject& operator=(const BoxedObject&) = delete;
BoxedObject& operator=(BoxedObject&&) = delete;
T& operator*() noexcept { return get(); }
const T& operator*() const noexcept { return get(); }
T* operator->() noexcept { return &get(); }
const T* operator->() const noexcept { return &get(); }
template<typename... TArgs>
void construct(TArgs&&... args)
{