Why doesn't the N3421 provide a noexcept classifier?

In N3421 - Creating functional operators more <> , a new specialization for std function objects:

template <> struct plus<void> {
  template <class T, class U> auto operator()(T&& t, U&& u) const
  -> decltype(std::forward<T>(t) + std::forward<U>(u));
};

instead

template <> struct plus<void> {
  template <class T, class U> auto operator()(T&& t, U&& u) const
  noexcept(noexcept(decltype(std::forward<T>(t) + std::forward<U>(u))
                     (std::move(std::forward<T>(t) + std::forward<U>(u)))))
  -> decltype(std::forward<T>(t) + std::forward<U>(u));
};
  • Is there a reason for this?
  • Does it make sense to use noexceptin this use case?

Edit: link to a working draft on github .

Edit 2: link to libC ++ plus specialization .

+4
source share
2 answers

LWG noexcept. , . , , , , noexcept, , , batshit .

, , . -, noexcept , constexpr. (STL), , .

-, LWG -, noexcept.

+6

@DeadMG noexcept , :

  • . ( ) .

  • , , LWG, , noexcept.

  • , move-constructor move-assign - ( , noexcept), noexcept. noexcept .

  • , "C" (, ), .

:

  • - . : , .

  • - , . undefined , . , , , , , .

, noexcept, noexcept.

, , - <functional> , , . , noexcept(true). :

.

+4

Source: https://habr.com/ru/post/1526728/


All Articles