mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-24 06:37:07 +00:00
Use C++20 concepts to require constraints on template parameters (#1977)
This commit is contained in:
+4
-2
@@ -32,6 +32,7 @@
|
||||
|
||||
%code {
|
||||
#include <algorithm>
|
||||
#include <concepts> // invocable
|
||||
#include <inttypes.h>
|
||||
#include <optional>
|
||||
#include <stdio.h>
|
||||
@@ -57,9 +58,10 @@
|
||||
|
||||
yy::parser::symbol_type yylex(); // Provided by lexer.cpp
|
||||
|
||||
template<typename NumCallbackFnT, typename StrCallbackFnT>
|
||||
static auto handleSymbolByType(
|
||||
std::string const &symName, NumCallbackFnT numCallback, StrCallbackFnT strCallback
|
||||
std::string const &symName,
|
||||
std::invocable<Expression const &> auto numCallback,
|
||||
std::invocable<std::string const &> auto strCallback
|
||||
) {
|
||||
if (Symbol *sym = sym_FindScopedSymbol(symName); sym && sym->type == SYM_EQUS) {
|
||||
return strCallback(*sym->getEqus());
|
||||
|
||||
Reference in New Issue
Block a user