11#pragma once
22
3- #include " boost/mp11/algorithm.hpp"
4- #include " boost/mp11/detail/mp_list.hpp"
5- #include " boost/mp11/detail/mp_rename.hpp"
63#include " corosig/util/Overloaded.hpp"
4+
75#include < boost/mp11.hpp>
6+ #include < boost/mp11/algorithm.hpp>
87#include < concepts>
98#include < cstring>
109#include < type_traits>
@@ -36,36 +35,36 @@ struct Error : std::variant<TYPES...> {
3635public:
3736 using Base::Base;
3837
39- char const *description () const noexcept {
38+ [[nodiscard]] char const *description () const noexcept {
4039 return visit (Overloaded{
4140 [](detail::WithDescription auto const &e) { return e.description (); },
4241 [](auto const &e) { return typeid (std::decay_t <decltype (e)>).name (); },
4342 });
4443 }
4544
4645 template <typename T>
47- bool holds () const noexcept {
46+ [[nodiscard]] bool holds () const noexcept {
4847 return std::holds_alternative<T>(*this );
4948 }
5049
5150 template <typename F>
52- decltype (auto ) visit(F &&f) noexcept {
51+ [[nodiscard]] decltype (auto ) visit(F &&f) noexcept {
5352 return std::visit (std::forward<F>(f), *this );
5453 }
5554
5655 template <typename F>
57- decltype (auto ) visit(F &&f) const noexcept {
56+ [[nodiscard]] decltype (auto ) visit(F &&f) const noexcept {
5857 return std::visit (std::forward<F>(f), *this );
5958 }
6059};
6160
6261namespace detail {
6362
6463template <template <class ...> class , class >
65- struct is_instance_of : std::false_type {};
64+ struct IsInstanceOf : std::false_type {};
6665
67- template <template <class ...> class TMPL , class ... Args >
68- struct is_instance_of <TMPL, TMPL<Args ...>> : std::true_type {};
66+ template <template <class ...> class TMPL , class ... ARGS >
67+ struct IsInstanceOf <TMPL, TMPL<ARGS ...>> : std::true_type {};
6968
7069template <template <typename ...> typename TMPL, typename ... TS>
7170using apply_unique =
@@ -81,8 +80,8 @@ struct extend_error_impl<Error<E1...>, Error<E2...>> {
8180
8281template <typename E1 , typename E2 >
8382using extend_error =
84- extend_error_impl<std::conditional_t <is_instance_of <Error, E1 >::value, E1 , Error<E1 >>,
85- std::conditional_t <is_instance_of <Error, E2 >::value, E2 , Error<E2 >>>::type;
83+ extend_error_impl<std::conditional_t <IsInstanceOf <Error, E1 >::value, E1 , Error<E1 >>,
84+ std::conditional_t <IsInstanceOf <Error, E2 >::value, E2 , Error<E2 >>>::type;
8685
8786} // namespace detail
8887
@@ -99,7 +98,7 @@ struct SyscallError {
9998
10099 static SyscallError current () noexcept ;
101100
102- char const *description () const noexcept ;
101+ [[nodiscard]] char const *description () const noexcept ;
103102
104103 int value;
105104};
0 commit comments