Skip to content

Commit

Permalink
Update #if checks for string_view support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Apr 3, 2024
1 parent e64e4dd commit 1825976
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/microfmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <cstring>
#include <iostream>
#include <string>
#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
#include <string_view>
#endif
#ifdef _MSC_VER
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace microfmt {
int64_value,
uint64_value,
string_value,
#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
string_view_value,
#endif
c_string_value,
Expand All @@ -128,7 +128,7 @@ namespace microfmt {
std::int64_t int64_value;
std::uint64_t uint64_value;
const std::string* string_value;
#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
std::string_view string_view_value;
#endif
const char* c_string_value;
Expand All @@ -147,7 +147,7 @@ namespace microfmt {
format_value(unsigned long int_val) : uint64_value(int_val), value(value_type::uint64_value) {}
format_value(unsigned long long int_val) : uint64_value(int_val), value(value_type::uint64_value) {}
format_value(const std::string& string) : string_value(&string), value(value_type::string_value) {}
#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
format_value(std::string_view sv) : string_view_value(sv), value(value_type::string_view_value) {}
#endif
format_value(const char* c_string) : c_string_value(c_string), value(value_type::c_string_value) {}
Expand Down Expand Up @@ -187,7 +187,7 @@ namespace microfmt {
case value_type::string_value:
do_write(out, string_value->begin(), string_value->end(), options);
break;
#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
case value_type::string_view_value:
do_write(out, string_view_value.begin(), string_view_value.end(), options);
break;
Expand Down Expand Up @@ -302,7 +302,7 @@ namespace microfmt {
}
}

#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#if __cplusplus >= 201703L
template<typename... Args>
std::string format(std::string_view fmt, Args&&... args) {
return detail::format<sizeof...(args)>(fmt.begin(), fmt.end(), {detail::format_value(args)...});
Expand Down

0 comments on commit 1825976

Please sign in to comment.