Skip to content

Commit

Permalink
std::result_of removed in C++20 (open-telemetry#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgolov authored Jun 16, 2020
1 parent b472384 commit 49eee20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ include(CTest)

find_package(Threads)

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Options for Visual C++ compiler:
# /Zc:__cplusplus - report an updated value for recent C++ language standards.
# Without this option MSVC returns the value of __cplusplus="199711L"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
endif()

if(WITH_PROTOBUF)
set(protobuf_MODULE_COMPATIBLE ON)
find_package(Protobuf CONFIG NAMES protobuf)
Expand Down
6 changes: 6 additions & 0 deletions api/include/opentelemetry/nostd/function_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ class function_ref<R(Args...)>
typename std::enable_if<!std::is_same<function_ref, typename std::decay<F>::type>::value,
int>::type = 0,
typename std::enable_if<
#if (__cplusplus >= 201703L)
// std::result_of deprecated in C++17, removed in C++20
std::is_convertible<typename std::invoke_result<F, Args...>::type, R>::value,
#else
// std::result_of since C++11
std::is_convertible<typename std::result_of<F &(Args...)>::type, R>::value,
#endif
int>::type = 0>
function_ref(F &&f)
{
Expand Down

0 comments on commit 49eee20

Please sign in to comment.