satisfies(UnaryPredicate const &)

| Home | Libraries | People | FAQ | More

##### 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>
    unspecified 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