Skip to content

Commit 7ae68da

Browse files
committed
dancing around compiler/library bugs
1 parent 1564242 commit 7ae68da

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

include/ctre/return_type.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <string_view>
99
#include <string>
1010
#include <iterator>
11+
#ifdef _MSC_VER
1112
#include <memory>
13+
#endif
1214
#include <iosfwd>
1315
#if __has_include(<charconv>)
1416
#include <charconv>
@@ -80,15 +82,11 @@ template <size_t Id, typename Name = void> struct captured_content {
8082
} else { // I'm doing this to avoid warning about dead code
8183
#endif
8284

83-
if constexpr (std::is_pointer_v<Iterator>) {
84-
return _begin;
85-
} else {
86-
#if __cpp_lib_to_address >= 201711L
87-
return std::to_address(_begin);
88-
#else
89-
return &*_begin;
90-
#endif
91-
}
85+
#ifdef _MSC_VER
86+
return std::to_address(_begin);
87+
#else
88+
return &*_begin;
89+
#endif
9290

9391
#if __cpp_char8_t >= 201811
9492
}

single-header/ctre-unicode.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,7 +3296,9 @@ struct utf8_range {
32963296
#include <string_view>
32973297
#include <string>
32983298
#include <iterator>
3299+
#ifdef _MSC_VER
32993300
#include <memory>
3301+
#endif
33003302
#include <iosfwd>
33013303
#if __has_include(<charconv>)
33023304
#include <charconv>
@@ -3368,15 +3370,11 @@ template <size_t Id, typename Name = void> struct captured_content {
33683370
} else { // I'm doing this to avoid warning about dead code
33693371
#endif
33703372

3371-
if constexpr (std::is_pointer_v<Iterator>) {
3372-
return _begin;
3373-
} else {
3374-
#if __cpp_lib_to_address >= 201711L
3375-
return std::to_address(_begin);
3376-
#else
3377-
return &*_begin;
3378-
#endif
3379-
}
3373+
#ifdef _MSC_VER
3374+
return std::to_address(_begin);
3375+
#else
3376+
return &*_begin;
3377+
#endif
33803378

33813379
#if __cpp_char8_t >= 201811
33823380
}

single-header/ctre.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,9 @@ struct utf8_range {
32933293
#include <string_view>
32943294
#include <string>
32953295
#include <iterator>
3296+
#ifdef _MSC_VER
32963297
#include <memory>
3298+
#endif
32973299
#include <iosfwd>
32983300
#if __has_include(<charconv>)
32993301
#include <charconv>
@@ -3365,15 +3367,11 @@ template <size_t Id, typename Name = void> struct captured_content {
33653367
} else { // I'm doing this to avoid warning about dead code
33663368
#endif
33673369

3368-
if constexpr (std::is_pointer_v<Iterator>) {
3369-
return _begin;
3370-
} else {
3371-
#if __cpp_lib_to_address >= 201711L
3372-
return std::to_address(_begin);
3373-
#else
3374-
return &*_begin;
3375-
#endif
3376-
}
3370+
#ifdef _MSC_VER
3371+
return std::to_address(_begin);
3372+
#else
3373+
return &*_begin;
3374+
#endif
33773375

33783376
#if __cpp_char8_t >= 201811
33793377
}

0 commit comments

Comments
 (0)