dolphin/Source/Core/Common/StringLiteral.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
464 B
C
Raw Normal View History

// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <algorithm>
namespace Common
{
// A useful template for passing string literals as arguments to templates
// from: https://ctrpeach.io/posts/cpp20-string-literal-template-parameters/
2023-01-31 04:29:16 +00:00
template <size_t N>
struct StringLiteral
{
consteval StringLiteral(const char (&str)[N]) { std::copy_n(str, N, value); }
char value[N];
};
} // namespace Common