mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 11:14:41 +00:00
Move string_literal to format.h
This commit is contained in:
parent
8a484ad577
commit
53316903e6
@ -686,17 +686,6 @@ struct has_to_string_view<
|
||||
T, void_t<decltype(detail::to_string_view(std::declval<T>()))>>
|
||||
: 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 {
|
||||
none_type,
|
||||
// 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 {};
|
||||
#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.
|
||||
template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
|
||||
FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
|
||||
|
Loading…
Reference in New Issue
Block a user