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

  • The Modern C++ Challenge
  • Marius Bancila
  • 81字
  • 2021-06-25 22:01:26

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));
主站蜘蛛池模板: 巴东县| 通榆县| 临潭县| 留坝县| 平乡县| 贵南县| 土默特左旗| 化隆| 东宁县| 宣武区| 伊宁市| 林西县| 广州市| 大洼县| 忻州市| 海门市| 铁岭市| 开封市| 鄂托克前旗| 甘德县| 南开区| 化德县| 同仁县| 辰溪县| 砀山县| 宁德市| 青川县| 古交市| 雷山县| 策勒县| 桃江县| 宜州市| 仙桃市| 红桥区| 寿光市| 清涧县| 平南县| 山西省| 阳朔县| 曲周县| 高唐县|