Template Class LiteralIndexedVector

Inheritance Relationships

Base Type

  • protected std::vector< _T >

Class Documentation

template <class _T>
class LiteralIndexedVector : protected std::vector<_T>

containers.h

Purpose: Defines the LiteralIndexVector() class. This stores items and access them via literal identification numbers.

Copyright (C) 2018 Zayd Hammoudeh. All rights reserved.

Author
Zayd Hammoudeh zayd@ucsc.edu
Version
0.00.00

This software may be modified and distributed under the terms of the MIT license. See the LICENSE file for details.

Original Author: Marc Thurley.

Public Functions

LiteralIndexedVector(VariableIndex size = 0)

Creates a vector twice the specified size.

Parameters
  • size: Expected number of variables

LiteralIndexedVector(VariableIndex size, const typename std::vector<_T>::value_type &__value)

Create a vector twice the specified size initialized to the specified value.

Parameters
  • size: Expected number of variables.
  • __value: Value to write into all locations in the vector

_T &operator[](const LiteralID lit)
const _T &operator[](const LiteralID &lit) const
std::vector<_T>::iterator begin()

Creates an iterator that points to the first element in the vector.

Return
Iterator to first element

void resize(VariableIndex _size)

Parameters
  • _size: Expected number of variables.

void resize(VariableIndex _size, const typename std::vector<_T>::value_type &_value)

Resizes the vector to twice the specified size. If a value is specified, it sets all the elements to the specified value.

Parameters
  • _size:
  • _value:

void reserve(VariableIndex _size)
LiteralID end_lit()

Calculated version of the last literal ID number. It is based off the size of the literal array and may have unexpected behavior if the numbers are not incrementally increasing.

Return
Negated version of the largest possible literal