- 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));
推薦閱讀
- Learning Selenium Testing Tools with Python
- Mastering SVG
- Python王者歸來
- JavaScript從入門到精通(第3版)
- Hands-On RESTful Web Services with Go
- 軟件架構:Python語言實現(xiàn)
- 微信小程序項目開發(fā)實戰(zhàn)
- .NET 3.5編程
- OpenGL Data Visualization Cookbook
- Java語言程序設計教程
- R Data Science Essentials
- 邊玩邊學Scratch3.0少兒趣味編程
- PostgreSQL Developer's Guide
- C語言程序設計教程
- Developing Java Applications with Spring and Spring Boot