Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

C++20 compatibility for library users / std::result_of removed #144

Open
xgcssch opened this issue Jan 25, 2022 · 3 comments
Open

C++20 compatibility for library users / std::result_of removed #144

xgcssch opened this issue Jan 25, 2022 · 3 comments

Comments

@xgcssch
Copy link

xgcssch commented Jan 25, 2022

As a library user, i would like to compile my code using the C++20 standard.

But in /3rd_party/include/opentracing/variant/variant.hpp' the std::result_of<>` template is used:

This template was removed in C++20: see https://en.cppreference.com/w/cpp/types/result_of

std::invoke_result<> can be used as an drop in replacement.

To make the code still compile in C++ versions below C++17 the code can use
__cpp_lib_is_invocable (https://en.cppreference.com/w/cpp/feature_test) to different

e. g.

            template <typename F, typename V, typename Enable = void>
            struct result_of_unary_visit
            {
#ifdef __cpp_lib_is_invocable
                using type = typename std::invoke_result<F, V&>::type;
#else
                using type = typename std::result_of<F(V&)>::type;
#endif
            };
            template <typename F, typename V, typename Enable = void>
            struct result_of_binary_visit
            {
#ifdef __cpp_lib_is_invocable
                using type = typename std::invoke_result<F, V&, V&>::type;
#else
                using type = typename std::result_of<F(V&, V&)>::type;
#endif
            };
@perseoGI
Copy link

perseoGI commented Sep 1, 2023

I would also greatly appreciate this change.

@perseoGI
Copy link

Any progress???

@Oberon00
Copy link
Contributor

Oberon00 commented Jan 26, 2024

@perseoGI This project is no longer maintained opentracing/specification#163

@yurishkuro: The deprecation notice is quite well-hidden in the current GitHub UI, maybe add it to readme or set the repository to archived/read-only?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants