mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Move string_literal to format.h
This commit is contained in:
@ -686,17 +686,6 @@ struct has_to_string_view<
|
|||||||
T, void_t<decltype(detail::to_string_view(std::declval<T>()))>>
|
T, void_t<decltype(detail::to_string_view(std::declval<T>()))>>
|
||||||
: std::true_type {};
|
: std::true_type {};
|
||||||
|
|
||||||
template <typename Char, Char... C> struct string_literal {
|
|
||||||
static constexpr Char value[sizeof...(C)] = {C...};
|
|
||||||
constexpr operator basic_string_view<Char>() const {
|
|
||||||
return {value, sizeof...(C)};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#if FMT_CPLUSPLUS < 201703L
|
|
||||||
template <typename Char, Char... C>
|
|
||||||
constexpr Char string_literal<Char, C...>::value[sizeof...(C)];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum class type {
|
enum class type {
|
||||||
none_type,
|
none_type,
|
||||||
// Integer types should go first,
|
// Integer types should go first,
|
||||||
|
@ -278,6 +278,17 @@ template <typename Char> using std_string_view = std::basic_string_view<Char>;
|
|||||||
template <typename T> struct std_string_view {};
|
template <typename T> struct std_string_view {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template <typename Char, Char... C> struct string_literal {
|
||||||
|
static constexpr Char value[sizeof...(C)] = {C...};
|
||||||
|
constexpr operator basic_string_view<Char>() const {
|
||||||
|
return {value, sizeof...(C)};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#if FMT_CPLUSPLUS < 201703L
|
||||||
|
template <typename Char, Char... C>
|
||||||
|
constexpr Char string_literal<Char, C...>::value[sizeof...(C)];
|
||||||
|
#endif
|
||||||
|
|
||||||
// Implementation of std::bit_cast for pre-C++20.
|
// Implementation of std::bit_cast for pre-C++20.
|
||||||
template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
|
template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
|
||||||
FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
|
FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
|
||||||
|
Reference in New Issue
Block a user