Added clang-tidy config and cleaned up the code a little.
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
~BoxedObject()
|
||||
{
|
||||
MIJIN_ASSERT(!constructed, "BoxedObject::~BoxedObject(): Object has not been destroyed prior to destructor!")
|
||||
MIJIN_ASSERT(!constructed, "BoxedObject::~BoxedObject(): Object has not been destroyed prior to destructor!");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void construct(TArgs&&... args)
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(!constructed, "BoxedObject::construct(): Attempt to construct an already constructed object!")
|
||||
MIJIN_ASSERT(!constructed, "BoxedObject::construct(): Attempt to construct an already constructed object!");
|
||||
constructed = true;
|
||||
#endif
|
||||
std::construct_at(&object_, std::forward<TArgs>(args)...);
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
void destroy()
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::destroy(): Attempt to destroy a not constructed object!")
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::destroy(): Attempt to destroy a not constructed object!");
|
||||
constructed = false;
|
||||
#endif
|
||||
std::destroy_at(&object_);
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void copyTo(BoxedObject& other) const
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::copy(): Attempt to copy a not constructed object!")
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::copy(): Attempt to copy a not constructed object!");
|
||||
#endif
|
||||
other.construct(object_);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
void moveTo(BoxedObject& other)
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::copy(): Attempt to copy a not constructed object!")
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::copy(): Attempt to copy a not constructed object!");
|
||||
#endif
|
||||
other.construct(std::move(object_));
|
||||
destroy();
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
[[nodiscard]] T& get()
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::get(): Attempt to access a not constructed object!")
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::get(): Attempt to access a not constructed object!");
|
||||
#endif
|
||||
return object_;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
[[nodiscard]] const T& get() const
|
||||
{
|
||||
#if MIJIN_BOXED_OBJECT_DEBUG
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::get(): Attempt to access a not constructed object!")
|
||||
MIJIN_ASSERT(constructed, "BoxedObject::get(): Attempt to access a not constructed object!");
|
||||
#endif
|
||||
return object_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user