diff --git a/.cspell.json b/.cspell.json
index af08ba1858c..d2973503eb1 100644
--- a/.cspell.json
+++ b/.cspell.json
@@ -19,7 +19,6 @@
"packages/@react-native-windows/tester",
"packages/react-native-platform-override/src/e2etest/collateral",
"vnext/Folly/TEMP_UntilFollyUpdate",
- "vnext/fmt/TEMP_UntilFmtUpdate",
"vnext/ReactCommon/TEMP_UntilReactCommonUpdate"
],
"useGitignore": true,
diff --git a/change/react-native-windows-5b504bd2-0614-447a-ac50-acdd3f30d0b0.json b/change/react-native-windows-5b504bd2-0614-447a-ac50-acdd3f30d0b0.json
new file mode 100644
index 00000000000..9f7a3d7d8e2
--- /dev/null
+++ b/change/react-native-windows-5b504bd2-0614-447a-ac50-acdd3f30d0b0.json
@@ -0,0 +1,7 @@
+{
+ "type": "none",
+ "comment": "update fmt",
+ "packageName": "react-native-windows",
+ "email": "hmalothu@microsoft.com",
+ "dependentChangeType": "none"
+}
diff --git a/vnext/Directory.Build.props b/vnext/Directory.Build.props
index 3fa720d4148..7244018e8fa 100644
--- a/vnext/Directory.Build.props
+++ b/vnext/Directory.Build.props
@@ -31,8 +31,8 @@
ad90720829db5ba0c3d0e44994856dcce33d7940
77cc847c842c49e7e3477c1e95da2b6540166d66
- 10.1.0
- ca2e3685b160617d3d95fcd9e789c4e06ca88
+ 11.0.2
+ 0c9fce2ffefecfdce794e1859584e25877b7b592
4b8a4a59c4e1b7b988b809dedffd89a7662aa785
diff --git a/vnext/fmt/TEMP_UntilFmtUpdate/core.h b/vnext/fmt/TEMP_UntilFmtUpdate/core.h
deleted file mode 100644
index f39c9bd8d1f..00000000000
--- a/vnext/fmt/TEMP_UntilFmtUpdate/core.h
+++ /dev/null
@@ -1,2925 +0,0 @@
-// Formatting library for C++ - the core API for char/UTF-8
-//
-// Copyright (c) 2012 - present, Victor Zverovich
-// All rights reserved.
-//
-// For the license information refer to format.h.
-
-#ifndef FMT_CORE_H_
-#define FMT_CORE_H_
-
-#include // std::byte
-#include // std::FILE
-#include // std::strlen
-#include
-#include
-#include // std::addressof
-#include
-#include
-
-// The fmt library version in the form major * 10000 + minor * 100 + patch.
-#define FMT_VERSION 100100
-
-#if defined(__clang__) && !defined(__ibmxl__)
-# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
-#else
-# define FMT_CLANG_VERSION 0
-#endif
-
-#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \
- !defined(__NVCOMPILER)
-# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#else
-# define FMT_GCC_VERSION 0
-#endif
-
-#ifndef FMT_GCC_PRAGMA
-// Workaround _Pragma bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884.
-# if FMT_GCC_VERSION >= 504
-# define FMT_GCC_PRAGMA(arg) _Pragma(arg)
-# else
-# define FMT_GCC_PRAGMA(arg)
-# endif
-#endif
-
-#ifdef __ICL
-# define FMT_ICC_VERSION __ICL
-#elif defined(__INTEL_COMPILER)
-# define FMT_ICC_VERSION __INTEL_COMPILER
-#else
-# define FMT_ICC_VERSION 0
-#endif
-
-#ifdef _MSC_VER
-# define FMT_MSC_VERSION _MSC_VER
-# define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__))
-#else
-# define FMT_MSC_VERSION 0
-# define FMT_MSC_WARNING(...)
-#endif
-
-#ifdef _MSVC_LANG
-# define FMT_CPLUSPLUS _MSVC_LANG
-#else
-# define FMT_CPLUSPLUS __cplusplus
-#endif
-
-#ifdef __has_feature
-# define FMT_HAS_FEATURE(x) __has_feature(x)
-#else
-# define FMT_HAS_FEATURE(x) 0
-#endif
-
-#if defined(__has_include) || FMT_ICC_VERSION >= 1600 || FMT_MSC_VERSION > 1900
-# define FMT_HAS_INCLUDE(x) __has_include(x)
-#else
-# define FMT_HAS_INCLUDE(x) 0
-#endif
-
-#ifdef __has_cpp_attribute
-# define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
-#else
-# define FMT_HAS_CPP_ATTRIBUTE(x) 0
-#endif
-
-#define FMT_HAS_CPP14_ATTRIBUTE(attribute) \
- (FMT_CPLUSPLUS >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute))
-
-#define FMT_HAS_CPP17_ATTRIBUTE(attribute) \
- (FMT_CPLUSPLUS >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute))
-
-// Check if relaxed C++14 constexpr is supported.
-// GCC doesn't allow throw in constexpr until version 6 (bug 67371).
-#ifndef FMT_USE_CONSTEXPR
-# if (FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VERSION >= 1912 || \
- (FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L)) && \
- !FMT_ICC_VERSION && (!defined(__NVCC__) || FMT_CPLUSPLUS >= 202002L)
-# define FMT_USE_CONSTEXPR 1
-# else
-# define FMT_USE_CONSTEXPR 0
-# endif
-#endif
-#if FMT_USE_CONSTEXPR
-# define FMT_CONSTEXPR constexpr
-#else
-# define FMT_CONSTEXPR
-#endif
-
-#if ((FMT_CPLUSPLUS >= 202002L) && \
- (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE > 9)) || \
- (FMT_CPLUSPLUS >= 201709L && FMT_GCC_VERSION >= 1002)
-# define FMT_CONSTEXPR20 constexpr
-#else
-# define FMT_CONSTEXPR20
-#endif
-
-// Check if constexpr std::char_traits<>::{compare,length} are supported.
-#if defined(__GLIBCXX__)
-# if FMT_CPLUSPLUS >= 201703L && defined(_GLIBCXX_RELEASE) && \
- _GLIBCXX_RELEASE >= 7 // GCC 7+ libstdc++ has _GLIBCXX_RELEASE.
-# define FMT_CONSTEXPR_CHAR_TRAITS constexpr
-# endif
-#elif defined(_LIBCPP_VERSION) && FMT_CPLUSPLUS >= 201703L && \
- _LIBCPP_VERSION >= 4000
-# define FMT_CONSTEXPR_CHAR_TRAITS constexpr
-#elif FMT_MSC_VERSION >= 1914 && FMT_CPLUSPLUS >= 201703L
-# define FMT_CONSTEXPR_CHAR_TRAITS constexpr
-#endif
-#ifndef FMT_CONSTEXPR_CHAR_TRAITS
-# define FMT_CONSTEXPR_CHAR_TRAITS
-#endif
-
-// Check if exceptions are disabled.
-#ifndef FMT_EXCEPTIONS
-# if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \
- (FMT_MSC_VERSION && !_HAS_EXCEPTIONS)
-# define FMT_EXCEPTIONS 0
-# else
-# define FMT_EXCEPTIONS 1
-# endif
-#endif
-
-// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.
-#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && \
- !defined(__NVCC__)
-# define FMT_NORETURN [[noreturn]]
-#else
-# define FMT_NORETURN
-#endif
-
-#ifndef FMT_NODISCARD
-# if FMT_HAS_CPP17_ATTRIBUTE(nodiscard)
-# define FMT_NODISCARD [[nodiscard]]
-# else
-# define FMT_NODISCARD
-# endif
-#endif
-
-#ifndef FMT_INLINE
-# if FMT_GCC_VERSION || FMT_CLANG_VERSION
-# define FMT_INLINE inline __attribute__((always_inline))
-# else
-# define FMT_INLINE inline
-# endif
-#endif
-
-#ifdef _MSC_VER
-# define FMT_UNCHECKED_ITERATOR(It) \
- using _Unchecked_type = It // Mark iterator as checked.
-#else
-# define FMT_UNCHECKED_ITERATOR(It) using unchecked_type = It
-#endif
-
-#ifndef FMT_BEGIN_NAMESPACE
-# define FMT_BEGIN_NAMESPACE \
- namespace fmt { \
- inline namespace v10 {
-# define FMT_END_NAMESPACE \
- } \
- }
-#endif
-
-#ifndef FMT_EXPORT
-# define FMT_EXPORT
-# define FMT_BEGIN_EXPORT
-# define FMT_END_EXPORT
-#endif
-
-#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
-# ifdef FMT_LIB_EXPORT
-# define FMT_API __declspec(dllexport)
-# elif defined(FMT_SHARED)
-# define FMT_API __declspec(dllimport)
-# endif
-#else
-# if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)
-# if defined(__GNUC__) || defined(__clang__)
-# define FMT_API __attribute__((visibility("default")))
-# endif
-# endif
-#endif
-#ifndef FMT_API
-# define FMT_API
-#endif
-
-// libc++ supports string_view in pre-c++17.
-#if FMT_HAS_INCLUDE() && \
- (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
-# include
-# define FMT_USE_STRING_VIEW
-#elif FMT_HAS_INCLUDE("experimental/string_view") && FMT_CPLUSPLUS >= 201402L
-# include
-# define FMT_USE_EXPERIMENTAL_STRING_VIEW
-#endif
-
-#ifndef FMT_UNICODE
-# define FMT_UNICODE !FMT_MSC_VERSION
-#endif
-
-#ifndef FMT_CONSTEVAL
-# if ((FMT_GCC_VERSION >= 1000 || FMT_CLANG_VERSION >= 1101) && \
- (!defined(__apple_build_version__) || \
- __apple_build_version__ >= 14000029L) && \
- FMT_CPLUSPLUS >= 202002L) || \
- (defined(__cpp_consteval) && \
- (!FMT_MSC_VERSION || _MSC_FULL_VER >= 193030704))
-// consteval is broken in MSVC before VS2022 and Apple clang before 14.
-# define FMT_CONSTEVAL consteval
-# define FMT_HAS_CONSTEVAL
-# else
-# define FMT_CONSTEVAL
-# endif
-#endif
-
-#ifndef FMT_USE_NONTYPE_TEMPLATE_ARGS
-# if defined(__cpp_nontype_template_args) && \
- ((FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L) || \
- __cpp_nontype_template_args >= 201911L) && \
- !defined(__NVCOMPILER) && !defined(__LCC__)
-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
-# else
-# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
-# endif
-#endif
-
-// Enable minimal optimizations for more compact code in debug mode.
-FMT_GCC_PRAGMA("GCC push_options")
-#if !defined(__OPTIMIZE__) && !defined(__NVCOMPILER) && !defined(__LCC__) && \
- !defined(__CUDACC__)
-FMT_GCC_PRAGMA("GCC optimize(\"Og\")")
-#endif
-
-FMT_BEGIN_NAMESPACE
-
-// Implementations of enable_if_t and other metafunctions for older systems.
-template
-using enable_if_t = typename std::enable_if::type;
-template
-using conditional_t = typename std::conditional::type;
-template using bool_constant = std::integral_constant;
-template
-using remove_reference_t = typename std::remove_reference::type;
-template
-using remove_const_t = typename std::remove_const::type;
-template
-using remove_cvref_t = typename std::remove_cv>::type;
-template struct type_identity { using type = T; };
-template using type_identity_t = typename type_identity::type;
-template
-using underlying_t = typename std::underlying_type::type;
-
-// Checks whether T is a container with contiguous storage.
-template struct is_contiguous : std::false_type {};
-template
-struct is_contiguous> : std::true_type {};
-
-struct monostate {
- constexpr monostate() {}
-};
-
-// An enable_if helper to be used in template parameters which results in much
-// shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed
-// to workaround a bug in MSVC 2019 (see #1140 and #1186).
-#ifdef FMT_DOC
-# define FMT_ENABLE_IF(...)
-#else
-# define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0
-#endif
-
-// This is defined in core.h instead of format.h to avoid injecting in std.
-// It is a template to avoid undesirable implicit conversions to std::byte.
-#ifdef __cpp_lib_byte
-template ::value)>
-inline auto format_as(T b) -> unsigned char {
- return static_cast(b);
-}
-#endif
-
-namespace detail {
-// Suppresses "unused variable" warnings with the method described in
-// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/.
-// (void)var does not work on many Intel compilers.
-template FMT_CONSTEXPR void ignore_unused(const T&...) {}
-
-constexpr FMT_INLINE auto is_constant_evaluated(
- bool default_value = false) noexcept -> bool {
-// Workaround for incompatibility between libstdc++ consteval-based
-// std::is_constant_evaluated() implementation and clang-14.
-// https://github.com/fmtlib/fmt/issues/3247
-#if FMT_CPLUSPLUS >= 202002L && defined(_GLIBCXX_RELEASE) && \
- _GLIBCXX_RELEASE >= 12 && \
- (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500)
- ignore_unused(default_value);
- return __builtin_is_constant_evaluated();
-#elif defined(__cpp_lib_is_constant_evaluated)
- ignore_unused(default_value);
- return std::is_constant_evaluated();
-#else
- return default_value;
-#endif
-}
-
-// Suppresses "conditional expression is constant" warnings.
-template constexpr FMT_INLINE auto const_check(T value) -> T {
- return value;
-}
-
-FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
- const char* message);
-
-#ifndef FMT_ASSERT
-# ifdef NDEBUG
-// FMT_ASSERT is not empty to avoid -Wempty-body.
-# define FMT_ASSERT(condition, message) \
- fmt::detail::ignore_unused((condition), (message))
-# else
-# define FMT_ASSERT(condition, message) \
- ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
- ? (void)0 \
- : fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
-# endif
-#endif
-
-#if defined(FMT_USE_STRING_VIEW)
-template using std_string_view = std::basic_string_view;
-#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
-template
-using std_string_view = std::experimental::basic_string_view;
-#else
-template struct std_string_view {};
-#endif
-
-#ifdef FMT_USE_INT128
-// Do nothing.
-#elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \
- !(FMT_CLANG_VERSION && FMT_MSC_VERSION)
-# define FMT_USE_INT128 1
-using int128_opt = __int128_t; // An optional native 128-bit integer.
-using uint128_opt = __uint128_t;
-template inline auto convert_for_visit(T value) -> T {
- return value;
-}
-#else
-# define FMT_USE_INT128 0
-#endif
-#if !FMT_USE_INT128
-enum class int128_opt {};
-enum class uint128_opt {};
-// Reduce template instantiations.
-template auto convert_for_visit(T) -> monostate { return {}; }
-#endif
-
-// Casts a nonnegative integer to unsigned.
-template
-FMT_CONSTEXPR auto to_unsigned(Int value) ->
- typename std::make_unsigned::type {
- FMT_ASSERT(std::is_unsigned::value || value >= 0, "negative value");
- return static_cast::type>(value);
-}
-
-FMT_CONSTEXPR inline auto is_utf8() -> bool {
- FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7";
-
- // Avoid buggy sign extensions in MSVC's constant evaluation mode (#2297).
- using uchar = unsigned char;
- return FMT_UNICODE || (sizeof(section) == 3 && uchar(section[0]) == 0xC2 &&
- uchar(section[1]) == 0xA7);
-}
-} // namespace detail
-
-/**
- An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
- subset of the API. ``fmt::basic_string_view`` is used for format strings even
- if ``std::string_view`` is available to prevent issues when a library is
- compiled with a different ``-std`` option than the client code (which is not
- recommended).
- */
-FMT_EXPORT
-template class basic_string_view {
- private:
- const Char* data_;
- size_t size_;
-
- public:
- using value_type = Char;
- using iterator = const Char*;
-
- constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {}
-
- /** Constructs a string reference object from a C string and a size. */
- constexpr basic_string_view(const Char* s, size_t count) noexcept
- : data_(s), size_(count) {}
-
- /**
- \rst
- Constructs a string reference object from a C string computing
- the size with ``std::char_traits::length``.
- \endrst
- */
- FMT_CONSTEXPR_CHAR_TRAITS
- FMT_INLINE
- basic_string_view(const Char* s)
- : data_(s),
- size_(detail::const_check(std::is_same::value &&
- !detail::is_constant_evaluated(true))
- ? std::strlen(reinterpret_cast(s))
- : std::char_traits::length(s)) {}
-
- /** Constructs a string reference from a ``std::basic_string`` object. */
- template
- FMT_CONSTEXPR basic_string_view(
- const std::basic_string& s) noexcept
- : data_(s.data()), size_(s.size()) {}
-
- template >::value)>
- FMT_CONSTEXPR basic_string_view(S s) noexcept
- : data_(s.data()), size_(s.size()) {}
-
- /** Returns a pointer to the string data. */
- constexpr auto data() const noexcept -> const Char* { return data_; }
-
- /** Returns the string size. */
- constexpr auto size() const noexcept -> size_t { return size_; }
-
- constexpr auto begin() const noexcept -> iterator { return data_; }
- constexpr auto end() const noexcept -> iterator { return data_ + size_; }
-
- constexpr auto operator[](size_t pos) const noexcept -> const Char& {
- return data_[pos];
- }
-
- FMT_CONSTEXPR void remove_prefix(size_t n) noexcept {
- data_ += n;
- size_ -= n;
- }
-
- FMT_CONSTEXPR_CHAR_TRAITS bool starts_with(
- basic_string_view sv) const noexcept {
- return size_ >= sv.size_ &&
- std::char_traits::compare(data_, sv.data_, sv.size_) == 0;
- }
- FMT_CONSTEXPR_CHAR_TRAITS bool starts_with(Char c) const noexcept {
- return size_ >= 1 && std::char_traits::eq(*data_, c);
- }
- FMT_CONSTEXPR_CHAR_TRAITS bool starts_with(const Char* s) const {
- return starts_with(basic_string_view(s));
- }
-
- // Lexicographically compare this string reference to other.
- FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const -> int {
- size_t str_size = size_ < other.size_ ? size_ : other.size_;
- int result = std::char_traits::compare(data_, other.data_, str_size);
- if (result == 0)
- result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);
- return result;
- }
-
- FMT_CONSTEXPR_CHAR_TRAITS friend auto operator==(basic_string_view lhs,
- basic_string_view rhs)
- -> bool {
- return lhs.compare(rhs) == 0;
- }
- friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool {
- return lhs.compare(rhs) != 0;
- }
- friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool {
- return lhs.compare(rhs) < 0;
- }
- friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool {
- return lhs.compare(rhs) <= 0;
- }
- friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool {
- return lhs.compare(rhs) > 0;
- }
- friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool {
- return lhs.compare(rhs) >= 0;
- }
-};
-
-FMT_EXPORT
-using string_view = basic_string_view;
-
-/** Specifies if ``T`` is a character type. Can be specialized by users. */
-FMT_EXPORT
-template struct is_char : std::false_type {};
-template <> struct is_char : std::true_type {};
-
-namespace detail {
-
-// A base class for compile-time strings.
-struct compile_string {};
-
-template
-struct is_compile_string : std::is_base_of {};
-
-template ::value)>
-FMT_INLINE auto to_string_view(const Char* s) -> basic_string_view {
- return s;
-}
-template
-inline auto to_string_view(const std::basic_string& s)
- -> basic_string_view {
- return s;
-}
-template
-constexpr auto to_string_view(basic_string_view s)
- -> basic_string_view {
- return s;
-}
-template >::value)>
-inline auto to_string_view(std_string_view s) -> basic_string_view {
- return s;
-}
-template ::value)>
-constexpr auto to_string_view(const S& s)
- -> basic_string_view {
- return basic_string_view(s);
-}
-void to_string_view(...);
-
-// Specifies whether S is a string type convertible to fmt::basic_string_view.
-// It should be a constexpr function but MSVC 2017 fails to compile it in
-// enable_if and MSVC 2015 fails to compile it as an alias template.
-// ADL is intentionally disabled as to_string_view is not an extension point.
-template
-struct is_string
- : std::is_class()))> {};
-
-template struct char_t_impl {};
-template struct char_t_impl::value>> {
- using result = decltype(to_string_view(std::declval()));
- using type = typename result::value_type;
-};
-
-enum class type {
- none_type,
- // Integer types should go first,
- int_type,
- uint_type,
- long_long_type,
- ulong_long_type,
- int128_type,
- uint128_type,
- bool_type,
- char_type,
- last_integer_type = char_type,
- // followed by floating-point types.
- float_type,
- double_type,
- long_double_type,
- last_numeric_type = long_double_type,
- cstring_type,
- string_type,
- pointer_type,
- custom_type
-};
-
-// Maps core type T to the corresponding type enum constant.
-template
-struct type_constant : std::integral_constant {};
-
-#define FMT_TYPE_CONSTANT(Type, constant) \
- template \
- struct type_constant \
- : std::integral_constant {}
-
-FMT_TYPE_CONSTANT(int, int_type);
-FMT_TYPE_CONSTANT(unsigned, uint_type);
-FMT_TYPE_CONSTANT(long long, long_long_type);
-FMT_TYPE_CONSTANT(unsigned long long, ulong_long_type);
-FMT_TYPE_CONSTANT(int128_opt, int128_type);
-FMT_TYPE_CONSTANT(uint128_opt, uint128_type);
-FMT_TYPE_CONSTANT(bool, bool_type);
-FMT_TYPE_CONSTANT(Char, char_type);
-FMT_TYPE_CONSTANT(float, float_type);
-FMT_TYPE_CONSTANT(double, double_type);
-FMT_TYPE_CONSTANT(long double, long_double_type);
-FMT_TYPE_CONSTANT(const Char*, cstring_type);
-FMT_TYPE_CONSTANT(basic_string_view, string_type);
-FMT_TYPE_CONSTANT(const void*, pointer_type);
-
-constexpr bool is_integral_type(type t) {
- return t > type::none_type && t <= type::last_integer_type;
-}
-constexpr bool is_arithmetic_type(type t) {
- return t > type::none_type && t <= type::last_numeric_type;
-}
-
-constexpr auto set(type rhs) -> int { return 1 << static_cast(rhs); }
-constexpr auto in(type t, int set) -> bool {
- return ((set >> static_cast(t)) & 1) != 0;
-}
-
-// Bitsets of types.
-enum {
- sint_set =
- set(type::int_type) | set(type::long_long_type) | set(type::int128_type),
- uint_set = set(type::uint_type) | set(type::ulong_long_type) |
- set(type::uint128_type),
- bool_set = set(type::bool_type),
- char_set = set(type::char_type),
- float_set = set(type::float_type) | set(type::double_type) |
- set(type::long_double_type),
- string_set = set(type::string_type),
- cstring_set = set(type::cstring_type),
- pointer_set = set(type::pointer_type)
-};
-
-FMT_NORETURN FMT_API void throw_format_error(const char* message);
-
-struct error_handler {
- constexpr error_handler() = default;
-
- // This function is intentionally not constexpr to give a compile-time error.
- FMT_NORETURN void on_error(const char* message) {
- throw_format_error(message);
- }
-};
-} // namespace detail
-
-/** Throws ``format_error`` with a given message. */
-using detail::throw_format_error;
-
-/** String's character type. */
-template using char_t = typename detail::char_t_impl::type;
-
-/**
- \rst
- Parsing context consisting of a format string range being parsed and an
- argument counter for automatic indexing.
- You can use the ``format_parse_context`` type alias for ``char`` instead.
- \endrst
- */
-FMT_EXPORT
-template class basic_format_parse_context {
- private:
- basic_string_view format_str_;
- int next_arg_id_;
-
- FMT_CONSTEXPR void do_check_arg_id(int id);
-
- public:
- using char_type = Char;
- using iterator = const Char*;
-
- explicit constexpr basic_format_parse_context(
- basic_string_view format_str, int next_arg_id = 0)
- : format_str_(format_str), next_arg_id_(next_arg_id) {}
-
- /**
- Returns an iterator to the beginning of the format string range being
- parsed.
- */
- constexpr auto begin() const noexcept -> iterator {
- return format_str_.begin();
- }
-
- /**
- Returns an iterator past the end of the format string range being parsed.
- */
- constexpr auto end() const noexcept -> iterator { return format_str_.end(); }
-
- /** Advances the begin iterator to ``it``. */
- FMT_CONSTEXPR void advance_to(iterator it) {
- format_str_.remove_prefix(detail::to_unsigned(it - begin()));
- }
-
- /**
- Reports an error if using the manual argument indexing; otherwise returns
- the next argument index and switches to the automatic indexing.
- */
- FMT_CONSTEXPR auto next_arg_id() -> int {
- if (next_arg_id_ < 0) {
- detail::throw_format_error(
- "cannot switch from manual to automatic argument indexing");
- return 0;
- }
- int id = next_arg_id_++;
- do_check_arg_id(id);
- return id;
- }
-
- /**
- Reports an error if using the automatic argument indexing; otherwise
- switches to the manual indexing.
- */
- FMT_CONSTEXPR void check_arg_id(int id) {
- if (next_arg_id_ > 0) {
- detail::throw_format_error(
- "cannot switch from automatic to manual argument indexing");
- return;
- }
- next_arg_id_ = -1;
- do_check_arg_id(id);
- }
- FMT_CONSTEXPR void check_arg_id(basic_string_view) {}
- FMT_CONSTEXPR void check_dynamic_spec(int arg_id);
-};
-
-FMT_EXPORT
-using format_parse_context = basic_format_parse_context;
-
-namespace detail {
-// A parse context with extra data used only in compile-time checks.
-template
-class compile_parse_context : public basic_format_parse_context {
- private:
- int num_args_;
- const type* types_;
- using base = basic_format_parse_context;
-
- public:
- explicit FMT_CONSTEXPR compile_parse_context(
- basic_string_view format_str, int num_args, const type* types,
- int next_arg_id = 0)
- : base(format_str, next_arg_id), num_args_(num_args), types_(types) {}
-
- constexpr auto num_args() const -> int { return num_args_; }
- constexpr auto arg_type(int id) const -> type { return types_[id]; }
-
- FMT_CONSTEXPR auto next_arg_id() -> int {
- int id = base::next_arg_id();
- if (id >= num_args_) throw_format_error("argument not found");
- return id;
- }
-
- FMT_CONSTEXPR void check_arg_id(int id) {
- base::check_arg_id(id);
- if (id >= num_args_) throw_format_error("argument not found");
- }
- using base::check_arg_id;
-
- FMT_CONSTEXPR void check_dynamic_spec(int arg_id) {
- detail::ignore_unused(arg_id);
-#if !defined(__LCC__)
- if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id]))
- throw_format_error("width/precision is not integer");
-#endif
- }
-};
-
-// Extracts a reference to the container from back_insert_iterator.
-template
-inline auto get_container(std::back_insert_iterator it)
- -> Container& {
- using base = std::back_insert_iterator;
- struct accessor : base {
- accessor(base b) : base(b) {}
- using base::container;
- };
- return *accessor(it).container;
-}
-
-template
-FMT_CONSTEXPR auto copy_str(InputIt begin, InputIt end, OutputIt out)
- -> OutputIt {
- while (begin != end) *out++ = static_cast(*begin++);
- return out;
-}
-
-template , U>::value&& is_char::value)>
-FMT_CONSTEXPR auto copy_str(T* begin, T* end, U* out) -> U* {
- if (is_constant_evaluated()) return copy_str(begin, end, out);
- auto size = to_unsigned(end - begin);
- if (size > 0) memcpy(out, begin, size * sizeof(U));
- return out + size;
-}
-
-/**
- \rst
- A contiguous memory buffer with an optional growing ability. It is an internal
- class and shouldn't be used directly, only via `~fmt::basic_memory_buffer`.
- \endrst
- */
-template class buffer {
- private:
- T* ptr_;
- size_t size_;
- size_t capacity_;
-
- protected:
- // Don't initialize ptr_ since it is not accessed to save a few cycles.
- FMT_MSC_WARNING(suppress : 26495)
- buffer(size_t sz) noexcept : size_(sz), capacity_(sz) {}
-
- FMT_CONSTEXPR20 buffer(T* p = nullptr, size_t sz = 0, size_t cap = 0) noexcept
- : ptr_(p), size_(sz), capacity_(cap) {}
-
- FMT_CONSTEXPR20 ~buffer() = default;
- buffer(buffer&&) = default;
-
- /** Sets the buffer data and capacity. */
- FMT_CONSTEXPR void set(T* buf_data, size_t buf_capacity) noexcept {
- ptr_ = buf_data;
- capacity_ = buf_capacity;
- }
-
- /** Increases the buffer capacity to hold at least *capacity* elements. */
- virtual FMT_CONSTEXPR20 void grow(size_t capacity) = 0;
-
- public:
- using value_type = T;
- using const_reference = const T&;
-
- buffer(const buffer&) = delete;
- void operator=(const buffer&) = delete;
-
- FMT_INLINE auto begin() noexcept -> T* { return ptr_; }
- FMT_INLINE auto end() noexcept -> T* { return ptr_ + size_; }
-
- FMT_INLINE auto begin() const noexcept -> const T* { return ptr_; }
- FMT_INLINE auto end() const noexcept -> const T* { return ptr_ + size_; }
-
- /** Returns the size of this buffer. */
- constexpr auto size() const noexcept -> size_t { return size_; }
-
- /** Returns the capacity of this buffer. */
- constexpr auto capacity() const noexcept -> size_t { return capacity_; }
-
- /** Returns a pointer to the buffer data (not null-terminated). */
- FMT_CONSTEXPR auto data() noexcept -> T* { return ptr_; }
- FMT_CONSTEXPR auto data() const noexcept -> const T* { return ptr_; }
-
- /** Clears this buffer. */
- void clear() { size_ = 0; }
-
- // Tries resizing the buffer to contain *count* elements. If T is a POD type
- // the new elements may not be initialized.
- FMT_CONSTEXPR20 void try_resize(size_t count) {
- try_reserve(count);
- size_ = count <= capacity_ ? count : capacity_;
- }
-
- // Tries increasing the buffer capacity to *new_capacity*. It can increase the
- // capacity by a smaller amount than requested but guarantees there is space
- // for at least one additional element either by increasing the capacity or by
- // flushing the buffer if it is full.
- FMT_CONSTEXPR20 void try_reserve(size_t new_capacity) {
- if (new_capacity > capacity_) grow(new_capacity);
- }
-
- FMT_CONSTEXPR20 void push_back(const T& value) {
- try_reserve(size_ + 1);
- ptr_[size_++] = value;
- }
-
- /** Appends data to the end of the buffer. */
- template void append(const U* begin, const U* end);
-
- template FMT_CONSTEXPR auto operator[](Idx index) -> T& {
- return ptr_[index];
- }
- template
- FMT_CONSTEXPR auto operator[](Idx index) const -> const T& {
- return ptr_[index];
- }
-};
-
-struct buffer_traits {
- explicit buffer_traits(size_t) {}
- auto count() const -> size_t { return 0; }
- auto limit(size_t size) -> size_t { return size; }
-};
-
-class fixed_buffer_traits {
- private:
- size_t count_ = 0;
- size_t limit_;
-
- public:
- explicit fixed_buffer_traits(size_t limit) : limit_(limit) {}
- auto count() const -> size_t { return count_; }
- auto limit(size_t size) -> size_t {
- size_t n = limit_ > count_ ? limit_ - count_ : 0;
- count_ += size;
- return size < n ? size : n;
- }
-};
-
-// A buffer that writes to an output iterator when flushed.
-template
-class iterator_buffer final : public Traits, public buffer {
- private:
- OutputIt out_;
- enum { buffer_size = 256 };
- T data_[buffer_size];
-
- protected:
- FMT_CONSTEXPR20 void grow(size_t) override {
- if (this->size() == buffer_size) flush();
- }
-
- void flush() {
- auto size = this->size();
- this->clear();
- out_ = copy_str(data_, data_ + this->limit(size), out_);
- }
-
- public:
- explicit iterator_buffer(OutputIt out, size_t n = buffer_size)
- : Traits(n), buffer(data_, 0, buffer_size), out_(out) {}
- iterator_buffer(iterator_buffer&& other)
- : Traits(other), buffer(data_, 0, buffer_size), out_(other.out_) {}
- ~iterator_buffer() { flush(); }
-
- auto out() -> OutputIt {
- flush();
- return out_;
- }
- auto count() const -> size_t { return Traits::count() + this->size(); }
-};
-
-template
-class iterator_buffer final
- : public fixed_buffer_traits,
- public buffer {
- private:
- T* out_;
- enum { buffer_size = 256 };
- T data_[buffer_size];
-
- protected:
- FMT_CONSTEXPR20 void grow(size_t) override {
- if (this->size() == this->capacity()) flush();
- }
-
- void flush() {
- size_t n = this->limit(this->size());
- if (this->data() == out_) {
- out_ += n;
- this->set(data_, buffer_size);
- }
- this->clear();
- }
-
- public:
- explicit iterator_buffer(T* out, size_t n = buffer_size)
- : fixed_buffer_traits(n), buffer(out, 0, n), out_(out) {}
- iterator_buffer(iterator_buffer&& other)
- : fixed_buffer_traits(other),
- buffer(std::move(other)),
- out_(other.out_) {
- if (this->data() != out_) {
- this->set(data_, buffer_size);
- this->clear();
- }
- }
- ~iterator_buffer() { flush(); }
-
- auto out() -> T* {
- flush();
- return out_;
- }
- auto count() const -> size_t {
- return fixed_buffer_traits::count() + this->size();
- }
-};
-
-template class iterator_buffer final : public buffer {
- protected:
- FMT_CONSTEXPR20 void grow(size_t) override {}
-
- public:
- explicit iterator_buffer(T* out, size_t = 0) : buffer(out, 0, ~size_t()) {}
-
- auto out() -> T* { return &*this->end(); }
-};
-
-// A buffer that writes to a container with the contiguous storage.
-template
-class iterator_buffer,
- enable_if_t::value,
- typename Container::value_type>>
- final : public buffer {
- private:
- Container& container_;
-
- protected:
- FMT_CONSTEXPR20 void grow(size_t capacity) override {
- container_.resize(capacity);
- this->set(&container_[0], capacity);
- }
-
- public:
- explicit iterator_buffer(Container& c)
- : buffer(c.size()), container_(c) {}
- explicit iterator_buffer(std::back_insert_iterator out, size_t = 0)
- : iterator_buffer(get_container(out)) {}
-
- auto out() -> std::back_insert_iterator {
- return std::back_inserter(container_);
- }
-};
-
-// A buffer that counts the number of code units written discarding the output.
-template class counting_buffer final : public buffer {
- private:
- enum { buffer_size = 256 };
- T data_[buffer_size];
- size_t count_ = 0;
-
- protected:
- FMT_CONSTEXPR20 void grow(size_t) override {
- if (this->size() != buffer_size) return;
- count_ += this->size();
- this->clear();
- }
-
- public:
- counting_buffer() : buffer(data_, 0, buffer_size) {}
-
- auto count() -> size_t { return count_ + this->size(); }
-};
-} // namespace detail
-
-template
-FMT_CONSTEXPR void basic_format_parse_context::do_check_arg_id(int id) {
- // Argument id is only checked at compile-time during parsing because
- // formatting has its own validation.
- if (detail::is_constant_evaluated() &&
- (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) {
- using context = detail::compile_parse_context;
- if (id >= static_cast(this)->num_args())
- detail::throw_format_error("argument not found");
- }
-}
-
-template
-FMT_CONSTEXPR void basic_format_parse_context::check_dynamic_spec(
- int arg_id) {
- if (detail::is_constant_evaluated() &&
- (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) {
- using context = detail::compile_parse_context;
- static_cast(this)->check_dynamic_spec(arg_id);
- }
-}
-
-FMT_EXPORT template class basic_format_arg;
-FMT_EXPORT template class basic_format_args;
-FMT_EXPORT template class dynamic_format_arg_store;
-
-// A formatter for objects of type T.
-FMT_EXPORT
-template
-struct formatter {
- // A deleted default constructor indicates a disabled formatter.
- formatter() = delete;
-};
-
-// Specifies if T has an enabled formatter specialization. A type can be
-// formattable even if it doesn't have a formatter e.g. via a conversion.
-template
-using has_formatter =
- std::is_constructible>;
-
-// An output iterator that appends to a buffer.
-// It is used to reduce symbol sizes for the common case.
-class appender : public std::back_insert_iterator> {
- using base = std::back_insert_iterator>;
-
- public:
- using std::back_insert_iterator>::back_insert_iterator;
- appender(base it) noexcept : base(it) {}
- FMT_UNCHECKED_ITERATOR(appender);
-
- auto operator++() noexcept -> appender& { return *this; }
- auto operator++(int) noexcept -> appender { return *this; }
-};
-
-namespace detail {
-
-template
-constexpr auto has_const_formatter_impl(T*)
- -> decltype(typename Context::template formatter_type().format(
- std::declval(), std::declval()),
- true) {
- return true;
-}
-template
-constexpr auto has_const_formatter_impl(...) -> bool {
- return false;
-}
-template
-constexpr auto has_const_formatter() -> bool {
- return has_const_formatter_impl(static_cast(nullptr));
-}
-
-template
-using buffer_appender = conditional_t::value, appender,
- std::back_insert_iterator>>;
-
-// Maps an output iterator to a buffer.
-template
-auto get_buffer(OutputIt out) -> iterator_buffer {
- return iterator_buffer(out);
-}
-template , Buf>::value)>
-auto get_buffer(std::back_insert_iterator out) -> buffer& {
- return get_container(out);
-}
-
-template
-FMT_INLINE auto get_iterator(Buf& buf, OutputIt) -> decltype(buf.out()) {
- return buf.out();
-}
-template
-auto get_iterator(buffer&, OutputIt out) -> OutputIt {
- return out;
-}
-
-struct view {};
-
-template struct named_arg : view {
- const Char* name;
- const T& value;
- named_arg(const Char* n, const T& v) : name(n), value(v) {}
-};
-
-template struct named_arg_info {
- const Char* name;
- int id;
-};
-
-template
-struct arg_data {
- // args_[0].named_args points to named_args_ to avoid bloating format_args.
- // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning.
- T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : +1)];
- named_arg_info named_args_[NUM_NAMED_ARGS];
-
- template
- arg_data(const U&... init) : args_{T(named_args_, NUM_NAMED_ARGS), init...} {}
- arg_data(const arg_data& other) = delete;
- auto args() const -> const T* { return args_ + 1; }
- auto named_args() -> named_arg_info* { return named_args_; }
-};
-
-template
-struct arg_data {
- // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning.
- T args_[NUM_ARGS != 0 ? NUM_ARGS : +1];
-
- template
- FMT_CONSTEXPR FMT_INLINE arg_data(const U&... init) : args_{init...} {}
- FMT_CONSTEXPR FMT_INLINE auto args() const -> const T* { return args_; }
- FMT_CONSTEXPR FMT_INLINE auto named_args() -> std::nullptr_t {
- return nullptr;
- }
-};
-
-template
-inline void init_named_args(named_arg_info*, int, int) {}
-
-template struct is_named_arg : std::false_type {};
-template struct is_statically_named_arg : std::false_type {};
-
-template
-struct is_named_arg> : std::true_type {};
-
-template ::value)>
-void init_named_args(named_arg_info* named_args, int arg_count,
- int named_arg_count, const T&, const Tail&... args) {
- init_named_args(named_args, arg_count + 1, named_arg_count, args...);
-}
-
-template ::value)>
-void init_named_args(named_arg_info* named_args, int arg_count,
- int named_arg_count, const T& arg, const Tail&... args) {
- named_args[named_arg_count++] = {arg.name, arg_count};
- init_named_args(named_args, arg_count + 1, named_arg_count, args...);
-}
-
-template
-FMT_CONSTEXPR FMT_INLINE void init_named_args(std::nullptr_t, int, int,
- const Args&...) {}
-
-template constexpr auto count() -> size_t { return B ? 1 : 0; }
-template constexpr auto count() -> size_t {
- return (B1 ? 1 : 0) + count();
-}
-
-template constexpr auto count_named_args() -> size_t {
- return count::value...>();
-}
-
-template
-constexpr auto count_statically_named_args() -> size_t {
- return count::value...>();
-}
-
-struct unformattable {};
-struct unformattable_char : unformattable {};
-struct unformattable_pointer : unformattable {};
-
-template struct string_value {
- const Char* data;
- size_t size;
-};
-
-template struct named_arg_value {
- const named_arg_info* data;
- size_t size;
-};
-
-template struct custom_value {
- using parse_context = typename Context::parse_context_type;
- void* value;
- void (*format)(void* arg, parse_context& parse_ctx, Context& ctx);
-};
-
-// A formatting argument value.
-template class value {
- public:
- using char_type = typename Context::char_type;
-
- union {
- monostate no_value;
- int int_value;
- unsigned uint_value;
- long long long_long_value;
- unsigned long long ulong_long_value;
- int128_opt int128_value;
- uint128_opt uint128_value;
- bool bool_value;
- char_type char_value;
- float float_value;
- double double_value;
- long double long_double_value;
- const void* pointer;
- string_value string;
- custom_value custom;
- named_arg_value named_args;
- };
-
- constexpr FMT_INLINE value() : no_value() {}
- constexpr FMT_INLINE value(int val) : int_value(val) {}
- constexpr FMT_INLINE value(unsigned val) : uint_value(val) {}
- constexpr FMT_INLINE value(long long val) : long_long_value(val) {}
- constexpr FMT_INLINE value(unsigned long long val) : ulong_long_value(val) {}
- FMT_INLINE value(int128_opt val) : int128_value(val) {}
- FMT_INLINE value(uint128_opt val) : uint128_value(val) {}
- constexpr FMT_INLINE value(float val) : float_value(val) {}
- constexpr FMT_INLINE value(double val) : double_value(val) {}
- FMT_INLINE value(long double val) : long_double_value(val) {}
- constexpr FMT_INLINE value(bool val) : bool_value(val) {}
- constexpr FMT_INLINE value(char_type val) : char_value(val) {}
- FMT_CONSTEXPR FMT_INLINE value(const char_type* val) {
- string.data = val;
- if (is_constant_evaluated()) string.size = {};
- }
- FMT_CONSTEXPR FMT_INLINE value(basic_string_view val) {
- string.data = val.data();
- string.size = val.size();
- }
- FMT_INLINE value(const void* val) : pointer(val) {}
- FMT_INLINE value(const named_arg_info* args, size_t size)
- : named_args{args, size} {}
-
- template FMT_CONSTEXPR20 FMT_INLINE value(T& val) {
- using value_type = remove_const_t;
- custom.value = const_cast(std::addressof(val));
- // Get the formatter type through the context to allow different contexts
- // have different extension points, e.g. `formatter` for `format` and
- // `printf_formatter` for `printf`.
- custom.format = format_custom_arg<
- value_type, typename Context::template formatter_type>;
- }
- value(unformattable);
- value(unformattable_char);
- value(unformattable_pointer);
-
- private:
- // Formats an argument of a custom type, such as a user-defined class.
- template
- static void format_custom_arg(void* arg,
- typename Context::parse_context_type& parse_ctx,
- Context& ctx) {
- auto f = Formatter();
- parse_ctx.advance_to(f.parse(parse_ctx));
- using qualified_type =
- conditional_t(), const T, T>;
- ctx.advance_to(f.format(*static_cast(arg), ctx));
- }
-};
-
-// To minimize the number of types we need to deal with, long is translated
-// either to int or to long long depending on its size.
-enum { long_short = sizeof(long) == sizeof(int) };
-using long_type = conditional_t;
-using ulong_type = conditional_t;
-
-template struct format_as_result {
- template ::value || std::is_class::value)>
- static auto map(U*) -> decltype(format_as(std::declval()));
- static auto map(...) -> void;
-
- using type = decltype(map(static_cast(nullptr)));
-};
-template using format_as_t = typename format_as_result::type;
-
-template
-struct has_format_as
- : bool_constant, void>::value> {};
-
-// Maps formatting arguments to core types.
-// arg_mapper reports errors by returning unformattable instead of using
-// static_assert because it's used in the is_formattable trait.
-template struct arg_mapper {
- using char_type = typename Context::char_type;
-
- FMT_CONSTEXPR FMT_INLINE auto map(signed char val) -> int { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(unsigned char val) -> unsigned {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(short val) -> int { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(unsigned short val) -> unsigned {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(int val) -> int { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(unsigned val) -> unsigned { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(long val) -> long_type { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(unsigned long val) -> ulong_type {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(long long val) -> long long { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(unsigned long long val)
- -> unsigned long long {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(int128_opt val) -> int128_opt {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(uint128_opt val) -> uint128_opt {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(bool val) -> bool { return val; }
-
- template ::value ||
- std::is_same::value)>
- FMT_CONSTEXPR FMT_INLINE auto map(T val) -> char_type {
- return val;
- }
- template ::value ||
-#ifdef __cpp_char8_t
- std::is_same::value ||
-#endif
- std::is_same::value ||
- std::is_same::value) &&
- !std::is_same::value,
- int> = 0>
- FMT_CONSTEXPR FMT_INLINE auto map(T) -> unformattable_char {
- return {};
- }
-
- FMT_CONSTEXPR FMT_INLINE auto map(float val) -> float { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(double val) -> double { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(long double val) -> long double {
- return val;
- }
-
- FMT_CONSTEXPR FMT_INLINE auto map(char_type* val) -> const char_type* {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(const char_type* val) -> const char_type* {
- return val;
- }
- template ::value && !std::is_pointer::value &&
- std::is_same>::value)>
- FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
- -> basic_string_view {
- return to_string_view(val);
- }
- template ::value && !std::is_pointer::value &&
- !std::is_same>::value)>
- FMT_CONSTEXPR FMT_INLINE auto map(const T&) -> unformattable_char {
- return {};
- }
-
- FMT_CONSTEXPR FMT_INLINE auto map(void* val) -> const void* { return val; }
- FMT_CONSTEXPR FMT_INLINE auto map(const void* val) -> const void* {
- return val;
- }
- FMT_CONSTEXPR FMT_INLINE auto map(std::nullptr_t val) -> const void* {
- return val;
- }
-
- // Use SFINAE instead of a const T* parameter to avoid a conflict with the
- // array overload.
- template <
- typename T,
- FMT_ENABLE_IF(
- std::is_pointer::value || std::is_member_pointer::value ||
- std::is_function::type>::value ||
- (std::is_convertible::value &&
- !std::is_convertible::value &&
- !has_formatter::value))>
- FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
- return {};
- }
-
- template ::value)>
- FMT_CONSTEXPR FMT_INLINE auto map(const T (&values)[N]) -> const T (&)[N] {
- return values;
- }
-
- // Only map owning types because mapping views can be unsafe.
- template