# atermpp::term_list¶

Include file:

#include "mcrl2/atermpp/aterm_list.h

class atermpp::term_list

## Public types¶

type const_iterator

typedef for term_list_iterator< Term >

Const iterator used to iterate through an term_list.

type const_reference

typedef for const Term &

Const reference to T.

type difference_type

typedef for ptrdiff_t

A signed integral type.

type iterator

typedef for term_list_iterator< Term >

Iterator used to iterate through an term_list.

type pointer

typedef for Term *

Pointer to T.

type reference

typedef for Term &

Reference to T.

type size_type

typedef for std::size_t

An unsigned integral type.

type value_type

typedef for Term

The type of object, T stored in the term_list.

## Protected member functions¶

term_list(detail::_aterm *t) noexcept

constructor for termlists from internally constructed terms delivered as reference.

## Public member functions¶

const_iterator begin() const

Returns a const_iterator pointing to the beginning of the term_list.

Returns: The beginning of the list.

bool empty() const

Returns true if the list’s size is 0.

Returns: True iff the list is empty.

const_iterator end() const

Returns a const_iterator pointing to the end of the term_list.

Returns: The end of the list.

const Term &front() const

Returns the first element of the list.

Returns: The term at the head of the list.

size_type max_size() const

Returns the largest possible size of the term_list.

Returns: The largest possible size of the list.

term_list &operator=(const term_list &other) noexcept = default

This class has user-declared copy constructor so declare copy and move assignment.

term_list &operator=(term_list &&other) noexcept = default
void pop_front()

Removes the first element of the list.

void push_front(const Term &el)

Inserts a new element at the beginning of the current list.

Parameters:

• el The term that is added.
size_type size() const

Returns the size of the term_list.

The complexity of this function is linear in the size of the list.

Returns: The size of the list.

const term_list<Term> &tail() const

Returns the tail of the list.

Returns: The tail of the list.

term_list() noexcept

Default constructor. Creates an empty list.

term_list(const term_list<Term> &t) noexcept

Copy constructor.

Parameters:

• t A list.
term_list(term_list<Term> &&t) noexcept

Move constructor.

Parameters:

• t A list.
term_list(Iter first, Iter last, typename std::enable_if<std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>::value>::type * = nullptr)

Creates a term_list with the elements from first to last.

It is assumed that the range can be traversed from last to first.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, typename std::enable_if<std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>::value>::type * = 0)

Creates a term_list with the elements from first to last converting the elements before inserting.

It is assumed that the range can be traversed from last to first. The operator () in the class ATermConverter is applied to each element before inserting it in the list.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
• convert_to_aterm A class with a () operation, which is applied to each element before it is put into the list.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter, typename std::enable_if<std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>::value>::type * = 0)

Creates a term_list with the elements from first to last, converting and filtering the list.

It is assumed that the range can be traversed from last to first. The operator () in the class ATermConverter is applied to each element before inserting it in the list. Elements are only inserted if the operator () of the class ATermFilter yields true when applied to such an element.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
• convert_to_aterm A class with a () operation, which is applied to each element before it is put into the list.
• aterm_filter A class with an operator () that is used to determine whether elements can be inserted in the list.
term_list(Iter first, Iter last, typename std::enable_if< !std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=nullptr)

Creates a term_list from the elements from first to last.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, typename std::enable_if< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=nullptr)

Creates a term_list from the elements from first to last converting the elements before inserting.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments. The operator () in the class ATermConverter is applied to each element before inserting it in the list.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
• convert_to_aterm A class with a () operation, whic is applied to each element before it is put into the list.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter, typename std::enable_if< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=nullptr)

Creates a term_list from the elements from first to last converting and filtering the elements before inserting.

The range is traversed from first to last. This requires to copy the elements internally, which is less efficient than this function with random access iterators as arguments. The operator () in the class ATermConverter is applied to each element before inserting it in the list. Elements are only inserted if the operator () of the class ATermFilter yields true when applied to such an element.

Parameters:

• first The start of a range of elements.
• last The end of a range of elements.
• convert_to_aterm A class with a () operation, whic is applied to each element before it is put into the list.
• aterm_filter A class with an operator () that is used to determine whether elements can be inserted in the list.
term_list(std::initializer_list<Term> init)

A constructor based on an initializer list.

This constructor is not made explicit to conform to initializer lists in standard containers.

Parameters:

• init The initialiser list.