boost::container模块实现检查容器相等性的测试程序
boost::container是一个C++模块,它实现了一组容器,包括vector、deque、list、set、map和unordered_set、unordered_map等。在实际开发中,我们经常需要比较两个容器是否相等,但是C++标准库并没有提供直接的方法。因此,在本篇文章中,我们将介绍如何使用boost::container模块实现检查容器相等性的测试程序。
首先,我们需要引入boost头文件和使用命名空间boost::container:
#include <boost/container/vector.hpp>
#include <boost/container/deque.hpp>
#include <boost/container/list.hpp>
#include <boost/container/set.hpp>
#include <boost/container/map.hpp>
#include <boost/container/unordered_set.hpp>
#include <boost/container/unordered_map.hpp>
#include <iostream>
using namespace boost::container;
然后,我们可以使用BOOST_CHECK_EQUAL_CONTAINER宏来检查两个容器是否相等: