...
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <ranges>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <format>
|
||||
|
||||
|
||||
/*
|
||||
@@ -15,9 +16,17 @@
|
||||
namespace adc::traits
|
||||
{
|
||||
|
||||
// check if type can be used with std::format_to
|
||||
// (from https://stackoverflow.com/questions/72430369/how-to-check-that-a-type-is-formattable-using-type-traits-concepts)
|
||||
template<typename T>
|
||||
concept formattable = requires (T& v, std::format_context ctx) {
|
||||
std::formatter<std::remove_cvref_t<T>>().format(v, ctx);
|
||||
};
|
||||
|
||||
|
||||
// range of char/const char
|
||||
template <typename R>
|
||||
concept adc_char_range = std::ranges::range<R> && std::is_same_v<std::remove_cv_t<std::ranges::range_value_t<R>>, char>;
|
||||
template <typename R, typename CharT = char>
|
||||
concept adc_char_range = std::ranges::range<R> && std::is_same_v<std::remove_cv_t<std::ranges::range_value_t<R>>, CharT>;
|
||||
|
||||
// deduce returned type of callable
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user