Lint fixes

This commit is contained in:
Scott Mansell
2023-01-31 17:29:16 +13:00
parent 11de923dcb
commit 31cfe8250d
39 changed files with 219 additions and 235 deletions

View File

@ -36,7 +36,7 @@ struct HookBase
using EventHook = std::unique_ptr<HookBase>;
template<StringLiteral EventName, typename... CallbackArgs>
template <StringLiteral EventName, typename... CallbackArgs>
class Event
{
public:
@ -46,12 +46,12 @@ private:
struct HookImpl : public HookBase
{
~HookImpl() override { Event::Remove(this); }
HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name){ }
HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name) {}
CallbackType m_fn;
std::string m_name;
};
public:
public:
// Returns a handle that will unregister the listener when destroyed.
static EventHook Register(CallbackType callback, std::string name)
{

View File

@ -7,11 +7,10 @@
// A useful template for passing string literals as arguments to templates
// from: https://ctrpeach.io/posts/cpp20-string-literal-template-parameters/
template<size_t N>
struct StringLiteral {
consteval StringLiteral(const char (&str)[N]) {
std::copy_n(str, N, value);
}
template <size_t N>
struct StringLiteral
{
consteval StringLiteral(const char (&str)[N]) { std::copy_n(str, N, value); }
char value[N];
};