Skip to content

Commit

Permalink
Merge pull request microsoft#16 from Esri/fra10563/c++20
Browse files Browse the repository at this point in the history
Cherry-pick c++20 support from upstream
  • Loading branch information
cfrankmiller authored Aug 14, 2024
2 parents f6f37e4 + d134832 commit 82b54ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if (WINDOWS_STORE OR WINDOWS_PHONE)
add_compile_options(/ZW)
endif()

if (NOT (MSVC_VERSION LESS 1920))
add_compile_options(/permissive-)
endif()
else()
message("-- Unknown compiler, success is doubtful.")
message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
Expand Down
18 changes: 6 additions & 12 deletions Release/include/cpprest/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,12 @@ class type_parser
public:
static pplx::task<T> parse(streams::streambuf<CharType> buffer)
{
typename _type_parser_integral_traits<T>::_is_integral ii;
typename _type_parser_integral_traits<T>::_is_unsigned ui;
return _parse(buffer, ii, ui);
typedef typename _type_parser_integral_traits<T>::_is_integral ii;
typedef typename _type_parser_integral_traits<T>::_is_unsigned ui;

static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream");

return _parse(buffer, ii {}, ui {});
}

private:
Expand All @@ -539,15 +542,6 @@ class type_parser
_parse_floating_point(buffer);
}

static pplx::task<T> _parse(streams::streambuf<CharType>, std::false_type, std::true_type)
{
#ifdef _WIN32
static_assert(false, "type is not supported for extraction from a stream");
#else
throw std::runtime_error("type is not supported for extraction from a stream");
#endif
}

static pplx::task<T> _parse(streams::streambuf<CharType> buffer, std::true_type, std::false_type)
{
return type_parser<CharType, int64_t>::parse(buffer).then([](pplx::task<int64_t> op) -> T {
Expand Down

0 comments on commit 82b54ae

Please sign in to comment.