Skip to content

Commit

Permalink
C++20 not Building with VS2019 (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Dec 16, 2021
1 parent 5aa6327 commit b021bd6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions api/include/opentelemetry/nostd/absl/meta/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,21 @@ using common_type_t = typename std::common_type<T...>::type;
template <typename T>
using underlying_type_t = typename std::underlying_type<T>::type;

template <typename T>
using result_of_t = typename std::result_of<T>::type;
namespace type_traits_internal {

#if __cplusplus >= 201703L
// std::result_of is deprecated (C++17) or removed (C++20)
template<typename> struct result_of;
template<typename F, typename... Args>
struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
#else
template<typename F> using result_of = std::result_of<F>;
#endif

} // namespace type_traits_internal

template<typename F>
using result_of_t = typename type_traits_internal::result_of<F>::type;

namespace type_traits_internal {
// In MSVC we can't probe std::hash or stdext::hash because it triggers a
Expand Down

0 comments on commit b021bd6

Please sign in to comment.