3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Add compact version of std::all_of

This commit is contained in:
Jakob Rath 2022-10-03 10:55:13 +02:00
parent 0bea276e82
commit cd2d197bb9
3 changed files with 18 additions and 8 deletions

View file

@ -20,11 +20,13 @@ Revision History:
#include "util/debug.h"
#include "util/memory_manager.h"
#include<ostream>
#include<climits>
#include<limits>
#include<stdint.h>
#include <ostream>
#include <climits>
#include <limits>
#include <stdint.h>
#include <string>
#include <algorithm>
#include <iterator>
#ifndef SIZE_MAX
#define SIZE_MAX std::numeric_limits<std::size_t>::max()
@ -374,3 +376,11 @@ inline size_t megabytes_to_bytes(unsigned mb) {
r = SIZE_MAX;
return r;
}
/** Compact version of std::all_of */
template <typename Container, typename Predicate>
bool all_of(Container const& c, Predicate f)
{
using std::begin, std::end; // allows begin(c) to also find c.begin()
return std::all_of(begin(c), end(c), std::forward<Predicate>(f));
}