为什么 C++20 中的容器没有 .ssize 成员函数?

Why don't containers in C++20 have .ssize member function?

我很困惑为什么 C++20 中的 STL 容器没有成员函数 .ssize(),而是唯一获得有符号大小的方法(除了明显的转换 .size() 结果)是一个自由函数。 我想不出任何“符合人体工程学”的原因,因为每个 STL 容器(forward_list 除外)都包含 .size() 方法。

注意:我不想在成员函数与自由函数之间展开圣战,但确实令人困惑的是,有一个名为 .size() 的成员函数,还有一些自由函数 size()ssize(),但没有名为 .ssize().

的成员函数

这里描述了一些背景 P1227:

... an ssize() member function should be added to all STL containers; this implied by extension that all containers should have ssize() member functions, and the amount of work to do that was strongly resisted by some in attendance.

At 2018 San Diego, the ssize() member functions did not have as much consensus as a proposal without them, and were removed.