void Dump(Stream *s, lldb::addr_t base_addr = 0,
uint32_t addr_width = 8) const;
- class ValueInRangeUnaryPredicate {
- public:
- ValueInRangeUnaryPredicate(lldb::addr_t value) : _value(value) {}
- bool operator()(const VMRange &range) const {
- return range.Contains(_value);
- }
- lldb::addr_t _value;
- };
-
- class RangeInRangeUnaryPredicate {
- public:
- RangeInRangeUnaryPredicate(VMRange range) : _range(range) {}
- bool operator()(const VMRange &range) const {
- return range.Contains(_range);
- }
- const VMRange &_range;
- };
-
static bool ContainsValue(const VMRange::collection &coll,
lldb::addr_t value);
bool VMRange::ContainsValue(const VMRange::collection &coll,
lldb::addr_t value) {
- ValueInRangeUnaryPredicate in_range_predicate(value);
- return llvm::find_if(coll, in_range_predicate) != coll.end();
+ return llvm::find_if(coll, [&](const VMRange &r) {
+ return r.Contains(value);
+ }) != coll.end();
}
bool VMRange::ContainsRange(const VMRange::collection &coll,
const VMRange &range) {
- RangeInRangeUnaryPredicate in_range_predicate(range);
- return llvm::find_if(coll, in_range_predicate) != coll.end();
+ return llvm::find_if(coll, [&](const VMRange &r) {
+ return r.Contains(range);
+ }) != coll.end();
}
void VMRange::Dump(Stream *s, lldb::addr_t offset, uint32_t addr_width) const {