Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
util_intops::IndexFilterView< ValueT, EnableVectorT > Class Template Reference

#include <views.h>

Classes

struct  IndexFilterViewIterator

Public Types

using value_type = const ValueT
using value_iterator = typename absl::Span<value_type>::iterator
using enable_iterator = util::range_const_iterator_type<EnableVectorT>

Public Member Functions

template<typename ValueRangeT>
 IndexFilterView (const ValueRangeT *values, const EnableVectorT *is_active_)
IndexFilterViewIterator begin () const
IndexFilterViewIterator end () const
absl::Span< value_typebase () const
template<typename IndexT>
decltype(auto) operator[] (IndexT index) const

Detailed Description

template<typename ValueT, typename EnableVectorT>
class util_intops::IndexFilterView< ValueT, EnableVectorT >

Somewhat equivalent to ValueFilterView<StrongIntRange, EnableVectorT> Looping over this view is equivalent to:

auto c_it = container.begin(); auto active_it = is_active.begin(); for (; active_it != is_active.end(); ++active_it, ++c_it) { if (*active_it) { your_code(*c_it); } }

Definition at line 280 of file views.h.

Member Typedef Documentation

◆ enable_iterator

template<typename ValueT, typename EnableVectorT>
using util_intops::IndexFilterView< ValueT, EnableVectorT >::enable_iterator = util::range_const_iterator_type<EnableVectorT>

Definition at line 284 of file views.h.

◆ value_iterator

template<typename ValueT, typename EnableVectorT>
using util_intops::IndexFilterView< ValueT, EnableVectorT >::value_iterator = typename absl::Span<value_type>::iterator

Definition at line 283 of file views.h.

◆ value_type

template<typename ValueT, typename EnableVectorT>
using util_intops::IndexFilterView< ValueT, EnableVectorT >::value_type = const ValueT

Definition at line 282 of file views.h.

Constructor & Destructor Documentation

◆ IndexFilterView()

template<typename ValueT, typename EnableVectorT>
template<typename ValueRangeT>
util_intops::IndexFilterView< ValueT, EnableVectorT >::IndexFilterView ( const ValueRangeT * values,
const EnableVectorT * is_active_ )
inline

Definition at line 322 of file views.h.

Member Function Documentation

◆ base()

template<typename ValueT, typename EnableVectorT>
absl::Span< value_type > util_intops::IndexFilterView< ValueT, EnableVectorT >::base ( ) const
inline

Definition at line 336 of file views.h.

◆ begin()

template<typename ValueT, typename EnableVectorT>
IndexFilterViewIterator util_intops::IndexFilterView< ValueT, EnableVectorT >::begin ( ) const
inline

Definition at line 328 of file views.h.

◆ end()

template<typename ValueT, typename EnableVectorT>
IndexFilterViewIterator util_intops::IndexFilterView< ValueT, EnableVectorT >::end ( ) const
inline

Definition at line 332 of file views.h.

◆ operator[]()

template<typename ValueT, typename EnableVectorT>
template<typename IndexT>
decltype(auto) util_intops::IndexFilterView< ValueT, EnableVectorT >::operator[] ( IndexT index) const
inline
Note
uses indices of the original container, not the filtered one

Definition at line 340 of file views.h.


The documentation for this class was generated from the following file: