bool CheckEqualContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont) { if(boostcont.size() != stdcont.size()) return false; typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end()); typename MyStdCont::const_iterator itstd(stdcont.begin()); typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend); if(dist != boostcont.size()){ return false; } std::size_t i = 0; for(; itboost != itboostend; ++itboost, ++itstd, ++i){ if(!CheckEqual(*itstd, *itboost)) return false; } return true; }
bool CheckEqualPairContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont) { if(boostcont.size() != stdcont.size()) return false; typedef typename MyBoostCont::key_type key_type; typedef typename MyBoostCont::mapped_type mapped_type; typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end()); typename MyStdCont::const_iterator itstd(stdcont.begin()); for(; itboost != itboostend; ++itboost, ++itstd){ if(itboost->first != key_type(itstd->first)) return false; if(itboost->second != mapped_type(itstd->second)) return false; } return true; }