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

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

@xgcssch

Description

@xgcssch

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
            };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions