mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-26 12:19:45 +01:00
Remove dependency on string_view
This commit is contained in:
@@ -49,6 +49,16 @@
|
||||
|
||||
#include "core.h"
|
||||
|
||||
// libc++ supports string_view in pre-c++17.
|
||||
#if FMT_HAS_INCLUDE(<string_view>) && \
|
||||
(FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
|
||||
# include <string_view>
|
||||
# define FMT_USE_STRING_VIEW
|
||||
#elif FMT_HAS_INCLUDE("experimental/string_view") && FMT_CPLUSPLUS >= 201402L
|
||||
# include <experimental/string_view>
|
||||
# define FMT_USE_EXPERIMENTAL_STRING_VIEW
|
||||
#endif
|
||||
|
||||
#if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L
|
||||
# define FMT_INLINE_VARIABLE inline
|
||||
#else
|
||||
@@ -285,6 +295,15 @@ FMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FMT_USE_STRING_VIEW)
|
||||
template <typename Char> using std_string_view = std::basic_string_view<Char>;
|
||||
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
|
||||
template <typename Char>
|
||||
using std_string_view = std::experimental::basic_string_view<Char>;
|
||||
#else
|
||||
template <typename T> struct std_string_view {};
|
||||
#endif
|
||||
|
||||
template <typename CharT, CharT... C> struct string_literal {
|
||||
static constexpr CharT value[sizeof...(C)] = {C...};
|
||||
constexpr operator basic_string_view<CharT>() const {
|
||||
|
||||
Reference in New Issue
Block a user