Skip to content

Commit 5fc7371

Browse files
authored
Merge pull request SqliteModernCpp#203 from marciso/msvc_lang
use _MSVC_LANG to include C++17 headers in Visual Studio
2 parents 65b82cf + 4bce44d commit 5fc7371

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

hdr/sqlite_modern_cpp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace sqlite {
2929
template<class T, bool Name = false>
3030
struct index_binding_helper {
3131
index_binding_helper(const index_binding_helper &) = delete;
32-
#if __cplusplus < 201703
32+
#if __cplusplus < 201703 || _MSVC_LANG <= 201703
3333
index_binding_helper(index_binding_helper &&) = default;
3434
#endif
3535
typename std::conditional<Name, const char *, int>::type index;

hdr/sqlite_modern_cpp/type_wrapper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
#include <memory>
66
#include <vector>
77
#ifdef __has_include
8-
#if __cplusplus >= 201703 && __has_include(<string_view>)
8+
#if (__cplusplus >= 201703 || _MSVC_LANG >= 201703) && __has_include(<string_view>)
99
#define MODERN_SQLITE_STRINGVIEW_SUPPORT
1010
#endif
1111
#endif
1212
#ifdef __has_include
13-
#if __cplusplus > 201402 && __has_include(<optional>)
13+
#if (__cplusplus > 201402 || _MSCV_LANG > 201402) && __has_include(<optional>)
1414
#define MODERN_SQLITE_STD_OPTIONAL_SUPPORT
1515
#elif __has_include(<experimental/optional>) && __apple_build_version__ < 11000000
1616
#define MODERN_SQLITE_EXPERIMENTAL_OPTIONAL_SUPPORT
1717
#endif
1818
#endif
1919

2020
#ifdef __has_include
21-
#if __cplusplus > 201402 && __has_include(<variant>)
21+
#if (__cplusplus > 201402 || _MSVC_LANG > 201402) && __has_include(<variant>)
2222
#define MODERN_SQLITE_STD_VARIANT_SUPPORT
2323
#endif
2424
#endif

hdr/sqlite_modern_cpp/utility/utf16_utf8.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace sqlite {
1717
std::size_t produced_output = 0;
1818
while(true) {
1919
char *used_output;
20-
switch(codecvt.out(state, remaining_input, &input[input.size()],
20+
switch(codecvt.out(state, remaining_input, input.data() + input.size(),
2121
remaining_input, &result[produced_output],
2222
&result[result.size() - 1] + 1, used_output)) {
2323
case std::codecvt_base::ok:
@@ -33,7 +33,7 @@ namespace sqlite {
3333
produced_output = used_output - result.data();
3434
result.resize(
3535
result.size()
36-
+ (std::max)((&input[input.size()] - remaining_input) * 3 / 2,
36+
+ (std::max)((input.data() + input.size() - remaining_input) * 3 / 2,
3737
std::ptrdiff_t(4)));
3838
}
3939
}

0 commit comments

Comments
 (0)