modernization: tweaks for c++20

Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-21 14:12:33 +03:00
committed by Seth Ladygo
parent 502c9cd67b
commit 86464cd083
40 changed files with 155 additions and 166 deletions

View File

@ -101,7 +101,7 @@ struct Sexp {
Sexp(const char *str): Sexp{std::string{str}} {}
Sexp(std::string_view sv): Sexp{std::string{sv}} {}
template<typename N, typename = std::enable_if_t<std::is_integral_v<N>> >
template<std::integral N>
Sexp(N n):value{static_cast<Number>(n)} {}
Sexp(const Symbol& sym): value{sym} {}
@ -305,13 +305,13 @@ MU_ENABLE_BITOPS(Sexp::Format);
/**
* String-literal; allow for ":foo"_sym to be a symbol
*/
static inline Sexp::Symbol
inline Sexp::Symbol
operator""_sym(const char* str, std::size_t n)
{
return Sexp::Symbol{str};
}
static inline std::ostream&
inline std::ostream&
operator<<(std::ostream& os, const Sexp::Type& stype)
{
os << Sexp::type_name(stype);
@ -319,7 +319,7 @@ operator<<(std::ostream& os, const Sexp::Type& stype)
}
static inline std::ostream&
inline std::ostream&
operator<<(std::ostream& os, const Sexp& sexp)
{
os << sexp.to_string();