mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-01 10:20:59 +00:00
Workaround C complex.h idiocy
This commit is contained in:
parent
29c6000137
commit
aec3bb5d0a
@ -211,16 +211,16 @@ class is_tuple_formattable_ {
|
|||||||
static constexpr const bool value = false;
|
static constexpr const bool value = false;
|
||||||
};
|
};
|
||||||
template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
|
template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
|
||||||
template <std::size_t... I>
|
template <std::size_t... Is>
|
||||||
static std::true_type check2(index_sequence<I...>,
|
static std::true_type check2(index_sequence<Is...>,
|
||||||
integer_sequence<bool, (I == I)...>);
|
integer_sequence<bool, (Is == Is)...>);
|
||||||
static std::false_type check2(...);
|
static std::false_type check2(...);
|
||||||
template <std::size_t... I>
|
template <std::size_t... Is>
|
||||||
static decltype(check2(
|
static decltype(check2(
|
||||||
index_sequence<I...>{},
|
index_sequence<Is...>{},
|
||||||
integer_sequence<
|
integer_sequence<
|
||||||
bool, (is_formattable<typename std::tuple_element<I, T>::type,
|
bool, (is_formattable<typename std::tuple_element<Is, T>::type,
|
||||||
C>::value)...>{})) check(index_sequence<I...>);
|
C>::value)...>{})) check(index_sequence<Is...>);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr const bool value =
|
static constexpr const bool value =
|
||||||
|
@ -101,17 +101,16 @@ template <typename T>
|
|||||||
using variant_index_sequence =
|
using variant_index_sequence =
|
||||||
std::make_index_sequence<std::variant_size<T>::value>;
|
std::make_index_sequence<std::variant_size<T>::value>;
|
||||||
|
|
||||||
template <typename>
|
template <typename> struct is_variant_like_ : std::false_type {};
|
||||||
struct is_variant_like_ : std::false_type {};
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
struct is_variant_like_<std::variant<Types...>> : std::true_type {};
|
struct is_variant_like_<std::variant<Types...>> : std::true_type {};
|
||||||
|
|
||||||
// formattable element check.
|
// formattable element check.
|
||||||
template <typename T, typename C> class is_variant_formattable_ {
|
template <typename T, typename C> class is_variant_formattable_ {
|
||||||
template <std::size_t... I>
|
template <std::size_t... Is>
|
||||||
static std::conjunction<
|
static std::conjunction<
|
||||||
is_formattable<std::variant_alternative_t<I, T>, C>...>
|
is_formattable<std::variant_alternative_t<Is, T>, C>...>
|
||||||
check(std::index_sequence<I...>);
|
check(std::index_sequence<Is...>);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr const bool value =
|
static constexpr const bool value =
|
||||||
|
@ -9,9 +9,7 @@
|
|||||||
#include "test-assert.h"
|
#include "test-assert.h"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define I 42 // simulate https://en.cppreference.com/w/c/numeric/complex/I
|
|
||||||
#include "fmt/core.h"
|
#include "fmt/core.h"
|
||||||
#undef I
|
|
||||||
|
|
||||||
#include <algorithm> // std::copy_n
|
#include <algorithm> // std::copy_n
|
||||||
#include <climits> // INT_MAX
|
#include <climits> // INT_MAX
|
||||||
|
@ -8,12 +8,14 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#define I 42 // simulate https://en.cppreference.com/w/c/numeric/complex/I
|
||||||
#include "fmt/chrono.h"
|
#include "fmt/chrono.h"
|
||||||
#include "fmt/color.h"
|
#include "fmt/color.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "fmt/ostream.h"
|
#include "fmt/ostream.h"
|
||||||
#include "fmt/ranges.h"
|
#include "fmt/ranges.h"
|
||||||
#include "fmt/xchar.h"
|
#include "fmt/xchar.h"
|
||||||
|
#undef I
|
||||||
|
|
||||||
// Exercise the API to verify that everything we expect to can compile.
|
// Exercise the API to verify that everything we expect to can compile.
|
||||||
void test_format_api() {
|
void test_format_api() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user