python - Python 的“all”函数的 C++ 等价物是什么?
问题描述
检查 bool 向量(或 bool 数组)的所有值是否都是 C++ 的方法是什么true
(只使用 1 行,如 Python)
在 Python 中,我可以做到
a = [true, true, true, false]
b = [true, true, true]
print(all(a)) # it will print false
print(all(b)) # it will print true
我可以通过创建一个函数来检查它,但我想知道它是否可以通过使用内置库来完成。
解决方案
推荐阅读
- ruby-on-rails - 如何使用 Ruby 获取网站 (url) cookie 列表
- react-native - 反应原生 - 缺少srcipt:ios
- zendesk - Zendesk Chat 小部件状态检查
- binding - 在 xamarin 中为 SuperPoweredSDK 创建绑定包装器?
- scala - 从列表中搜索数据框以及在 Scala 的新列中找到的所有元素
- c# - 切换事件委托
- python - 需要加入代码才能获得所需的输出
- python - 当文件在 pytest 中可用时如何测试 FileNotFound 异常
- javascript - 使用 1 个按钮切换显示/隐藏 Google 标记
- python - 如何记录 Jupyter 笔记本输入以进行审计?