- 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));
推薦閱讀
- 軟件項(xiàng)目估算
- Java EE框架整合開(kāi)發(fā)入門(mén)到實(shí)戰(zhàn):Spring+Spring MVC+MyBatis(微課版)
- oreilly精品圖書(shū):軟件開(kāi)發(fā)者路線圖叢書(shū)(共8冊(cè))
- WordPress Plugin Development Cookbook(Second Edition)
- Symfony2 Essentials
- Getting Started with Gulp
- Swift語(yǔ)言實(shí)戰(zhàn)精講
- iOS自動(dòng)化測(cè)試實(shí)戰(zhàn):基于Appium、Python與Pytest
- Visual Foxpro 9.0數(shù)據(jù)庫(kù)程序設(shè)計(jì)教程
- 零基礎(chǔ)學(xué)HTML+CSS
- ASP.NET 4.0 Web程序設(shè)計(jì)
- R語(yǔ)言數(shù)據(jù)挖掘:實(shí)用項(xiàng)目解析
- INSTANT Apache Hive Essentials How-to
- Java自然語(yǔ)言處理(原書(shū)第2版)
- ArcPy and ArcGIS(Second Edition)