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

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));
主站蜘蛛池模板: 柳林县| 卢龙县| 沧源| 邢台县| 大厂| 南宫市| 图片| 隆林| 临夏市| 临清市| 永安市| 嘉荫县| 乳山市| 布尔津县| 贵州省| 郸城县| 惠东县| 慈利县| 彭州市| 梧州市| 七台河市| 天峻县| 兴化市| 镇平县| 承德县| 土默特右旗| 海原县| 镇赉县| 神农架林区| 星座| 苗栗市| 隆尧县| 秀山| 米林县| 甘德县| 龙山县| 儋州市| 高密市| 开原市| 翼城县| 同心县|