[std::forward_list
具有member function:
size_type remove(const T& value);
和non-member function std::erase
声明如下:
template<class T, class Alloc, class U>
typename forward_list<T, Alloc>::size_type
erase(forward_list<T, Alloc>& c, const U& value);
[请注意,非成员函数std::erase
与U
的类型不同value
;而成员函数remove
只需将T
键入value
。
为什么std::erase
不只将T
用作value
?
不一致之处背后是否有任何设计依据?