Blender V5.0
blender::binary_search Namespace Reference

Namespaces

namespace  tests

Functions

template<typename Iterator, typename Predicate>
static int64_t first_if (Iterator begin, Iterator end, Predicate &&predicate)
template<typename Iterator, typename Predicate>
static int64_t last_if (Iterator begin, Iterator end, Predicate &&predicate)
template<typename Range, typename Predicate>
int64_t first_if (const Range &range, Predicate &&predicate)
template<typename Range, typename Predicate>
int64_t last_if (const Range &range, Predicate &&predicate)

Function Documentation

◆ first_if() [1/2]

template<typename Range, typename Predicate>
int64_t blender::binary_search::first_if ( const Range & range,
Predicate && predicate )

Definition at line 45 of file BLI_binary_search.hh.

References first_if().

◆ first_if() [2/2]

template<typename Iterator, typename Predicate>
int64_t blender::binary_search::first_if ( Iterator begin,
Iterator end,
Predicate && predicate )
static

Find the index of the first element where the predicate is true. The predicate must also be true for all following elements. If the predicate is false for all elements, the size of the range is returned.

Definition at line 21 of file BLI_binary_search.hh.

References begin().

Referenced by blender::index_mask::IndexMask::find_larger_equal(), blender::unique_sorted_indices::find_size_of_next_range(), first_if(), blender::get_bake_frame_indices(), blender::index_mask::segments_from_indices(), blender::binary_search::tests::TEST(), blender::binary_search::tests::TEST(), and blender::binary_search::tests::TEST().

◆ last_if() [1/2]

template<typename Range, typename Predicate>
int64_t blender::binary_search::last_if ( const Range & range,
Predicate && predicate )

Definition at line 51 of file BLI_binary_search.hh.

References last_if().

◆ last_if() [2/2]

template<typename Iterator, typename Predicate>
int64_t blender::binary_search::last_if ( Iterator begin,
Iterator end,
Predicate && predicate )
static

Find the index of the last element where the predicate is true. The predicate must also be true for all previous elements. If the predicate is false for all elements, the -1 is returned.

Definition at line 35 of file BLI_binary_search.hh.

References begin().

Referenced by blender::index_mask::IndexMask::index_to_iterator(), last_if(), blender::binary_search::tests::TEST(), blender::binary_search::tests::TEST(), and blender::binary_search::tests::TEST().