citra-emu
/
citra-canary
Archived
1
0
Fork 0

common: Add StringLiteral

This commit is contained in:
Merry 2022-11-19 22:44:16 +00:00
parent f298278f37
commit 7cae35024f
2 changed files with 25 additions and 0 deletions

View File

@ -104,6 +104,7 @@ add_library(common STATIC
serialization/boost_flat_set.h
serialization/boost_small_vector.hpp
serialization/boost_vector.hpp
string_literal.h
string_util.cpp
string_util.h
swap.h

View File

@ -0,0 +1,24 @@
// Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <algorithm>
#include <cstddef>
namespace Common {
template <size_t N>
struct StringLiteral {
constexpr StringLiteral(const char (&str)[N]) {
std::copy_n(str, N, value);
}
static constexpr std::size_t strlen = N - 1;
static constexpr std::size_t size = N;
char value[N];
};
} // namespace Common