Loading...
Searching...
No Matches
Opm::Action::Result::ValueRange< T > Class Template Reference

Random access range of values. More...

`#include <ActionResult.hpp>`

## Public Types

using | RandIt = typename std::vector<T>::const_iterator
| Random access iterator.

## Public Member Functions

| ValueRange (RandIt first, RandIt last, bool isSorted=false)
| Constructor.
auto | begin () const
| Beginning of value range's elements.
auto | end () const
| End of value range's elements.
auto | empty () const
| Predicate for an empty value range.
auto | size () const
| Number of elements in the value range.
std::vector< T > | asVector () const
| Convert value range to a std::vector.
bool | hasElement (const T &elem) const
| Element existence predicate.

## Detailed Description

template<typename T>
class Opm::Action::Result::ValueRange< T >

Random access range of values.

Poor-man's substitute for C++20's std::span<T>.

Template Parameters

  T | Element type of range. Typically std::string since the common use case of class ValueRange<> is to represent a sequence of well or group names.

## Member Typedef Documentation

## RandIt

template<typename T>

using Opm::Action::Result::ValueRange< T >::RandIt = typename std::vector<T>::const_iterator

Random access iterator.

Class ValueRange<> assumes that the underlying sequence is a std::vector<T> of sufficient lifetime.

## Constructor & Destructor Documentation

## ValueRange()

template<typename T>

Opm::Action::Result::ValueRange< T >::ValueRange | ( | RandIt | first,
|  | RandIt | last,
|  | bool | isSorted = false )

inline explicit

Constructor.

Forms a ValueRange object from an iterator range.

Parameters

  [in] | first | First element in value range.
  [in] | last | One past the end of the elements in the value range.
  [in] | isSorted | Wether or not the value range is sorted by . In that case, element existence can be established in O(log(n)) time. This is an optimisation hook.

## Member Function Documentation

## asVector()

template<typename T>

std::vector< T > Opm::Action::Result::ValueRange< T >::asVector | ( |  | ) | const

inline

Convert value range to a std::vector.

Copies elements.

## hasElement()

template<typename T>

bool Opm::Action::Result::ValueRange< T >::hasElement | ( | const T & | elem | ) | const

inline

Element existence predicate.

Parameters

  [in] | elem | Element for which to check existence.

Returns
  Whether or not `elem` exists in the value range.

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

- opm/input/eclipse/Schedule/Action/ActionResult.hpp