【发布时间】:2014-03-12 05:24:42
【问题描述】:
在N3421 - Making Operator Functors greater<> 中,std 函数对象的新特化是:
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));
};
而不是
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));
};
- 有什么原因吗?
- 在这个用例中省略
noexcept重要吗?
【问题讨论】:
标签: c++ c++-standard-library function-object c++14