- 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));
推薦閱讀
- Docker and Kubernetes for Java Developers
- 工程軟件開發技術基礎
- Python數據可視化:基于Bokeh的可視化繪圖
- PHP程序設計(慕課版)
- Software Testing using Visual Studio 2012
- 神經網絡編程實戰:Java語言實現(原書第2版)
- Python高級編程
- 大模型RAG實戰:RAG原理、應用與系統構建
- 學習正則表達式
- 單片機C語言程序設計實訓100例
- Scratch趣味編程:陪孩子像搭積木一樣學編程
- Android應用開發深入學習實錄
- Java Web從入門到精通(第3版)
- 區塊鏈國產化實踐指南:基于Fabric 2.0
- Oracle Database XE 11gR2 Jump Start Guide