Skip to content

Commit 9e13fcc

Browse files
committed
VS 2019 support
1 parent 6add436 commit 9e13fcc

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

lib/inc/sys_string/config.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@
111111
#define SYS_STRING_LIBCPP_AT_LEAST(v) 0
112112
#endif
113113

114+
#if defined(__GLIBCXX__)
115+
#define SYS_STRING_GLIBCXX_AT_LEAST(v) (_GLIBCXX_RELEASE >= (v))
116+
#else
117+
#define SYS_STRING_GLIBCXX_AT_LEAST(v) 0
118+
#endif
119+
114120
#if __cpp_lib_endian < 201907
115121
#error Your standard library does not support std::endian
116122
#endif
@@ -128,10 +134,21 @@
128134
#endif
129135

130136

131-
#if __cpp_lib_format >= 201907L || (SYS_STRING_LIBCPP_AT_LEAST(170000) && __has_include(<format>))
137+
#if __cpp_lib_format >= 202207L \
138+
|| (SYS_STRING_LIBCPP_AT_LEAST(170000) && __has_include(<format>)) \
139+
|| (SYS_STRING_GLIBCXX_AT_LEAST(13) && __has_include(<format>))
132140

133141
#define SYS_STRING_SUPPORTS_STD_FORMAT 1
134142

135143
#endif
136144

145+
// True iff the compiler reliably matches trailing requires-clauses on
146+
// out-of-line definitions of constrained member templates.
147+
#if (defined(__apple_build_version__) && __apple_build_version__ < 14030022) \
148+
|| (defined(_MSC_VER) && _MSC_VER < 1930)
149+
#define SYS_STRING_HAS_TRAILING_REQUIRES_BUG 1
150+
#else
151+
#define SYS_STRING_HAS_TRAILING_REQUIRES_BUG 0
152+
#endif
153+
137154
#endif

lib/inc/sys_string/impl/misc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ namespace sysstr
269269
template<class Storage>
270270
template<class Search, class OutIt>
271271
auto sys_string_t<Storage>::split(OutIt dest, Search search) const -> OutIt
272-
#if !(defined(__apple_build_version__) && __apple_build_version__ < 14030022)
272+
#if !SYS_STRING_HAS_TRAILING_REQUIRES_BUG
273273
requires(std::output_iterator<OutIt, sys_string_t> &&
274274
std::is_invocable_v<Search, typename sys_string_t::utf32_access::iterator, std::default_sentinel_t>)
275275
#endif
@@ -281,7 +281,7 @@ namespace sysstr
281281
template<class Storage>
282282
template<sys_string_or_char<Storage> StringOrChar, class OutIt>
283283
auto sys_string_t<Storage>::split(OutIt dest, const StringOrChar & sep, size_t max_split) const -> OutIt
284-
#if !(defined(__apple_build_version__) && __apple_build_version__ < 14030022)
284+
#if !SYS_STRING_HAS_TRAILING_REQUIRES_BUG
285285
requires(std::output_iterator<OutIt, sys_string_t>)
286286
#endif
287287
{

lib/inc/sys_string/sys_string.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,15 @@ namespace sysstr
345345

346346
template<class Search, class OutIt>
347347
auto split(OutIt dest, Search search) const -> OutIt
348-
#if !(defined(__apple_build_version__) && __apple_build_version__ < 14030022)
348+
#if !SYS_STRING_HAS_TRAILING_REQUIRES_BUG
349349
requires(std::output_iterator<OutIt, sys_string_t> &&
350350
std::is_invocable_v<Search, typename sys_string_t::utf32_access::iterator, std::default_sentinel_t>)
351351
#endif
352352
;
353353

354354
template<sys_string_or_char<Storage> StringOrChar, class OutIt>
355355
auto split(OutIt dest, const StringOrChar & sep, size_t max_split = std::numeric_limits<size_t>::max()) const -> OutIt
356-
#if !(defined(__apple_build_version__) && __apple_build_version__ < 14030022)
356+
#if !SYS_STRING_HAS_TRAILING_REQUIRES_BUG
357357
requires(std::output_iterator<OutIt, sys_string_t>)
358358
#endif
359359
;

0 commit comments

Comments
 (0)