Use C++20 concepts to require constraints on template parameters (#1977)

This commit is contained in:
Rangi
2026-05-22 17:54:34 -04:00
committed by GitHub
parent 728bed39d5
commit dce14fd4b8
12 changed files with 64 additions and 27 deletions
+7 -2
View File
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <vector>
#include "helpers.hpp" // InvocableR
#include "style.hpp"
#define TRACE_SEPARATOR "<-"
@@ -25,8 +26,12 @@ extern Tracing tracing;
bool trace_ParseTraceDepth(char const *arg);
template<typename NodeT, typename NameFnT, typename LineNoFnT>
void trace_PrintBacktrace(std::vector<NodeT> const &stack, NameFnT getName, LineNoFnT getLineNo) {
template<typename NodeT>
void trace_PrintBacktrace(
std::vector<NodeT> const &stack,
InvocableR<char const *, NodeT const &> auto getName,
InvocableR<uint32_t, NodeT const &> auto getLineNo
) {
size_t n = stack.size();
if (n == 0) {
return; // LCOV_EXCL_LINE