Simplify with C++17 #46

issue ryanofsky opened this issue on March 15, 2021
  1. ryanofsky commented at 6:34 PM on March 15, 2021: collaborator

    Saving note from an email, there are a ton of a simplifications that can be made now that C++17 is required:

    A lot of code needs better comments, and there are also big swathes that are overcomplicated because they were written to use c++11, and can now be simplified with c++17. Examples:

    • AUTO_RETURN macro uses can be replaced with auto return types
    • Priority<0>, Prioriity<1>, Priority<2> overloads used for conditional compilation can all go away and be replaced with if constexpr
    • std::tuple indexing code can go away and be replaced with std::apply

    Basically all of mp/util.h can go away. Also kj::mvCapture uses can replaced with shorter direct captures.

  2. ryanofsky referenced this in commit bc6624a5d3 on Dec 31, 2021
  3. maflcko commented at 12:30 PM on August 26, 2026: contributor

    I guess all of this was fixed already, except for Priority? Maybe the issue can be updated?

    There are also some trivial/minimal fixups:

    diff --git a/include/mp/util.h b/include/mp/util.h
    index 3074201..ffbb51b 100644
    --- a/include/mp/util.h
    +++ b/include/mp/util.h
    @@ -101,7 +100,7 @@ struct Split<index, TypeList<Type, _Second...>, TypeList<_First...>, false>
     template <typename Callable>
    -using ResultOf = decltype(std::declval<Callable>()());
    +using ResultOf = std::invoke_result_t<Callable>;
     
    -//! Substitutue for std::remove_cvref_t
    +//! Type helper removing cv-qualifiers and references.
     template <typename T>
    -using RemoveCvRef = std::remove_cv_t<std::remove_reference_t<T>>;
    +using RemoveCvRef = std::remove_cvref_t<T>;
     
    
  4. maflcko commented at 2:01 PM on August 26, 2026: contributor

    Another thing would be CTADs, but this requires bumping the min compiler versions ...

  5. ryanofsky commented at 2:36 PM on August 26, 2026: collaborator

    Yes a lot of the cleanups mentioned above are taken care of now. I think the biggest remaining improvement might be modernizing the clientInvoke / serverInvoke code which was written for C++11 and has a pretty archaic and convoluted style. I suspect there are a lot of simplifications that can be made there.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-16 10:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me