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

#include <views.h>

Classes

struct  ValueFilterViewIterator

Public Types

using value_type = const ValueT
using value_iterator = typename absl::Span<value_type>::iterator

Public Member Functions

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

Detailed Description

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

This view provides access to elements of a container of integral types, which are used as indices to a filter (in) vector. The view filters and returns only those elements that, when used a subscript to the filter vector, are evaluated to a true value. Looping over this view is equivalent to:

for (decltype(auto) item : container) { if (is_active[item]) { your_code(iter); } }

Definition at line 205 of file views.h.

Member Typedef Documentation

◆ value_iterator

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

Definition at line 208 of file views.h.

◆ value_type

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

Definition at line 207 of file views.h.

Constructor & Destructor Documentation

◆ ValueFilterView()

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

Definition at line 241 of file views.h.

Member Function Documentation

◆ base()

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

Definition at line 261 of file views.h.

◆ begin()

template<typename ValueT, typename EnableVectorT>
ValueFilterViewIterator util_intops::ValueFilterView< ValueT, EnableVectorT >::begin ( ) const
inline

Definition at line 246 of file views.h.

◆ end()

template<typename ValueT, typename EnableVectorT>
ValueFilterViewIterator util_intops::ValueFilterView< ValueT, EnableVectorT >::end ( ) const
inline

Definition at line 249 of file views.h.

◆ operator[]()

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

Definition at line 255 of file views.h.


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