forked from fmtlib/fmt
move fixed_string from compile.h to format.h
This commit is contained in:
committed by
Victor Zverovich
parent
bb006f9735
commit
fc56af14c2
@ -13,15 +13,6 @@
|
|||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
#ifndef FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
|
||||||
# if defined(__cpp_nontype_template_parameter_class) && \
|
|
||||||
(!FMT_GCC_VERSION || FMT_GCC_VERSION >= 903)
|
|
||||||
# define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 1
|
|
||||||
# else
|
|
||||||
# define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 0
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
@ -126,14 +117,6 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
|
|||||||
#define FMT_COMPILE(s) FMT_STRING_IMPL(s, fmt::detail::compiled_string)
|
#define FMT_COMPILE(s) FMT_STRING_IMPL(s, fmt::detail::compiled_string)
|
||||||
|
|
||||||
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||||
template <typename Char, size_t N> struct fixed_string {
|
|
||||||
constexpr fixed_string(const Char (&str)[N]) {
|
|
||||||
copy_str<Char, const Char*, Char*>(static_cast<const Char*>(str), str + N,
|
|
||||||
data);
|
|
||||||
}
|
|
||||||
Char data[N]{};
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Char, size_t N, fixed_string<Char, N> Str>
|
template <typename Char, size_t N, fixed_string<Char, N> Str>
|
||||||
struct udl_compiled_string : compiled_string {
|
struct udl_compiled_string : compiled_string {
|
||||||
using char_type = Char;
|
using char_type = Char;
|
||||||
|
@ -263,6 +263,15 @@ inline int ctzll(uint64_t x) {
|
|||||||
FMT_END_NAMESPACE
|
FMT_END_NAMESPACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||||
|
# if defined(__cpp_nontype_template_parameter_class) && \
|
||||||
|
(!FMT_GCC_VERSION || FMT_GCC_VERSION >= 903)
|
||||||
|
# define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 1
|
||||||
|
# else
|
||||||
|
# define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
@ -3908,6 +3917,19 @@ void vprint(basic_string_view<Char> format_str, wformat_args args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FMT_MODULE_EXPORT_END
|
FMT_MODULE_EXPORT_END
|
||||||
|
|
||||||
|
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||||
|
namespace detail {
|
||||||
|
template <typename Char, size_t N> struct fixed_string {
|
||||||
|
constexpr fixed_string(const Char (&str)[N]) {
|
||||||
|
copy_str<Char, const Char*, Char*>(static_cast<const Char*>(str), str + N,
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
Char data[N]{};
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FMT_USE_USER_DEFINED_LITERALS
|
#if FMT_USE_USER_DEFINED_LITERALS
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename Char> struct udl_formatter {
|
template <typename Char> struct udl_formatter {
|
||||||
|
Reference in New Issue
Block a user