Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
satisfies(UnaryPredicate const &)

Generate satisfies() predicate.

Description

A wrapper around user-defined UnaryPredicate checking if Value should be returned by spatial query.

Synopsis
template<typename UnaryPredicate>
detail::satisfies<UnaryPredicate, false> boost::geometry::index::satisfies(UnaryPredicate const & pred)
Template parameter(s)

Parameter

Description

UnaryPredicate

A type of unary predicate function or function object.

Parameter(s)

Type

Name

Description

UnaryPredicate const &

pred

The unary predicate function or function object.

Example

bool is_red(Value const& v) { return v.is_red(); }

struct is_red_o {
template <typename Value> bool operator()(Value const& v) { return v.is_red(); }
}

// ...

rt.query(index::intersects(box) && index::satisfies(is_red),
std::back_inserter(result));

rt.query(index::intersects(box) && index::satisfies(is_red_o()),
std::back_inserter(result));

#ifndef BOOST_NO_CXX11_LAMBDAS
rt.query(index::intersects(box) && index::satisfies([](Value const& v) { return v.is_red(); }),
std::back_inserter(result));
#endif


PrevUpHomeNext