9#include "json_helpers.h"
13 template <
typename FUNC>
14 std::string interpolate_simple(std::string_view str,
FUNC&&
func)
16 static_assert(std::invocable<FUNC, std::string_view> && std::constructible_from<std::string, std::invoke_result_t<FUNC, std::string_view>>,
"function must take a stringable and return a string");
21 if (str.empty())
break;
33 template <
bool SYNTAX>
34 std::string interpolate_eval(std::string_view str, eval::environment<SYNTAX>&
env)
40 if (str.empty())
break;
51 using nlohmann::to_string;
52 using ghassanpl::string_ops::to_string;
53 if constexpr (
requires { { to_string(
val) }; })
54 result += to_string(
val);
constexpr auto bit_count
Equal to the number of bits in the type.
auto visit(nlohmann::json const &j, VISIT_FUNC &&func)
Calls func with the actual value inside j; similar to std::visit
std::string_view consume_until(std::string_view &str, FUNC &&pred)
Consumes characters from the beginning of str until one matches pred(str[0]), exclusive.
char consume(std::string_view &str)
Consumes and returns the first character in the str, or \0 if no more characters.
std::string_view consume_until_delim(std::string_view &str, char c)
Consumes characters from the beginning of str until one is equal to c, inclusive.
Primary namespace for everything in this library.