named_expressions_range

Defined in header: <ixion/named_expressions_range.hpp>

class named_expressions_range

STL-compliant range over the named expressions of one scope, either the global scope or one sheet. Returned by model_context::iterate_named_expressions. The expressions are visited in the order of their names. Supports range-for and STL/range algorithms via its nested const_iterator.

The caller has to ensure that the named expressions of the scope do not change for the duration of the iteration.

Public Functions

named_expressions_range()

Construct a range over no named expressions.

named_expressions_range(const named_expressions_range &other)

Copy constructor.

named_expressions_range(named_expressions_range &&other)

Move constructor.

~named_expressions_range()
named_expressions_range &operator=(const named_expressions_range &other)

Copy assignment.

named_expressions_range &operator=(named_expressions_range &&other)

Move assignment.

const_iterator begin() const

Get an iterator to the first named expression of the range.

const_iterator end() const

Get an iterator past the last named expression of the range.

const_iterator cbegin() const

Get an iterator to the first named expression of the range.

const_iterator cend() const

Get an iterator past the last named expression of the range.

std::size_t size() const

Get the number of named expressions in the range.

bool empty() const

Check whether the range has no named expressions.

Friends

friend class detail::model_context_impl
class const_iterator

Forward iterator over the named expressions of a named_expressions_range. The entry it yields lives inside the iterator, so the reference stays valid as long as the iterator does.

Public Types

using iterator_category = std::forward_iterator_tag

Iterator category, which is forward iterator.

using value_type = entry

Type of the values the iterator yields.

using difference_type = std::ptrdiff_t

Type of the difference between two iterators.

using reference = const entry&

Reference type of the yielded values.

using pointer = const entry*

Pointer type of the yielded values.

Public Functions

const_iterator()

Construct an iterator at the end position of an empty range. It equals any other default-constructed iterator.

const_iterator(const const_iterator &other)

Copy constructor.

const_iterator(const_iterator &&other)

Move constructor.

~const_iterator()
const_iterator &operator=(const const_iterator &other)

Copy assignment.

const_iterator &operator=(const_iterator &&other)

Move assignment.

const_iterator &operator++()

Advance to the next named expression.

const_iterator operator++(int)

Advance to the next named expression and return the previous position.

reference operator*() const

Get the current named expression.

pointer operator->() const

Get a pointer to the current named expression.

bool operator==(const const_iterator &other) const

Compare the positions of two iterators.

struct entry

One named expression yielded by the iteration. Both references refer to storage inside the model and remain valid as long as the named expression stays in the model.

Public Members

const std::string &name

Name of the expression.

const named_expression_t &expression

The expression itself.