1 Commits

Author SHA1 Message Date
fcfe551c5c Run on PR to main also
All checks were successful
Bigfoot / Build & Test Debug (Unity Build: OFF) (push) Successful in 27s
Bigfoot / Build & Test Debug (Unity Build: ON) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: OFF) (push) Successful in 25s
Bigfoot / Build & Test RelWithDebInfo (Unity Build: ON) (push) Successful in 26s
Bigfoot / Build & Test Release (Unity Build: OFF) (push) Successful in 19s
Bigfoot / Build & Test Release (Unity Build: ON) (push) Successful in 19s
Bigfoot / Clang Format Checks (push) Successful in 9s
SonarQube only on push to main
2026-02-02 07:10:20 +01:00
2 changed files with 18 additions and 11 deletions

View File

@@ -1,10 +1,9 @@
name: Bigfoot
on:
push:
branches:
- main
- Development
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
build-and-test:
@@ -36,7 +35,7 @@ jobs:
run: infer run --compilation-database build/Debug/compile_commands.json
- name: SonarQube Scan
if: github.head_ref == 'main' || github.ref_name == 'main'
if: github.event_name == 'push'
uses: SonarSource/sonarqube-scan-action@v7.0.0
with:
args: >

View File

@@ -9,7 +9,6 @@
#include <EASTL/array.h>
#include <EASTL/bit.h>
#include <EASTL/optional.h>
#include <EASTL/type_traits.h>
#include <EASTL/utility.h>
@@ -33,7 +32,7 @@ class Singleton
*/
static constexpr TYPE& Instance()
{
return ms_instance.value();
return *eastl::bit_cast<TYPE*>(ms_instance.data());
}
class Lifetime
@@ -79,7 +78,9 @@ class Singleton
template<typename... ARGS>
static void Initialize(ARGS&&... p_args)
{
ms_instance.emplace(eastl::forward<ARGS>(p_args)...);
new (ms_instance.data()) TYPE(eastl::forward<ARGS>(p_args)...);
ms_initialized = true;
}
/**
@@ -88,13 +89,20 @@ class Singleton
*/
static void Finalize()
{
ms_instance.reset();
eastl::bit_cast<TYPE*>(ms_instance.data())->~TYPE();
ms_initialized = false;
}
/**
* The singleton.
*/
inline static eastl::optional<TYPE> ms_instance;
alignas(alignof(TYPE)) inline static eastl::array<std::byte, sizeof(TYPE)> ms_instance;
/**
* Is the singleton initialized?
*/
inline static bool ms_initialized = false;
};
} // namespace Bigfoot
#endif