| 1 | // Copyright 2023 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <algorithm> |
| 7 | |
| 8 | namespace Common |
| 9 | { |
| 10 | // A useful template for passing string literals as arguments to templates |
| 11 | // from: https://ctrpeach.io/posts/cpp20-string-literal-template-parameters/ |
| 12 | template <size_t N> |
| 13 | struct StringLiteral |
| 14 | { |
| 15 | consteval StringLiteral(const char (&str)[N]) { std::copy_n(str, N, value); } |
| 16 | |
| 17 | char value[N]; |
| 18 | }; |
| 19 | |
| 20 | } // namespace Common |