Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
STL 或 Boost 是否包含用于比较不同类型容器内容的算法。如果没有人写过这样的算法。我会称之为equal_contents或干脆equals。当断言某些算法为不同的输入容器类型返回相同的内容时,这很有用。
equal_contents
equals
是的,有std::equal算法。您需要将迭代器传递给该算法,容器的类型无关紧要。