官术网_书友最值得收藏!

20. Container any, all, none

Write a set of general-purpose functions that enable checking whether any, all, or none of the specified arguments are present in a given container. These functions should make it possible to write code as follows:

std::vector<int> v{ 1, 2, 3, 4, 5, 6 };
assert(contains_any(v, 0, 3, 30));

std::array<int, 6> a{ { 1, 2, 3, 4, 5, 6 } };
assert(contains_all(a, 1, 3, 5, 6));

std::list<int> l{ 1, 2, 3, 4, 5, 6 };
assert(!contains_none(l, 0, 6));
主站蜘蛛池模板: 澄迈县| 大丰市| 繁昌县| 陆丰市| 剑河县| 城口县| 湖州市| 肃南| 黄平县| 陈巴尔虎旗| 星座| 宁南县| 高邮市| 中方县| 阳高县| 临高县| 报价| 湖南省| 四子王旗| 会东县| 冀州市| 定州市| 崇左市| 永吉县| 凤山县| 拉孜县| 白山市| 天长市| 长岛县| 涿州市| 三原县| 泽库县| 改则县| 临沂市| 吉水县| 永年县| 潜山县| 北辰区| 来宾市| 新巴尔虎右旗| 苍南县|