- 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));
推薦閱讀
- Java入門很輕松(微課超值版)
- Julia機器學習核心編程:人人可用的高性能科學計算
- Python數據可視化之Matplotlib與Pyecharts實戰
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- Access 2010數據庫應用技術(第2版)
- Learning YARN
- 零基礎學C語言程序設計
- 編程改變生活:用Python提升你的能力(進階篇·微課視頻版)
- 從0到1:HTML5 Canvas動畫開發
- INSTANT JQuery Flot Visual Data Analysis
- R的極客理想:量化投資篇
- 啊哈C語言!:邏輯的挑戰(修訂版)
- Vue.js 3.x高效前端開發(視頻教學版)
- Java 11 and 12:New Features
- Building Clouds with Windows Azure Pack