containers.segmentedvector - ICE 0.1 API documentation

ICE 0.1 API documentation

# containers.segmentedvector

Dynamic array struct that never moves its contents in memory.

struct SegmentedVector(T,long segmentSize = 1024) if (segmentSize > 0);

  Dynamic array with manually managed memory that never moves its contents in memory.

  Pointers to elements of a SegmentedVector are safe, unlike Vector which can move its contents on reallocation.
  To simplify its implementation, SegmentedVector is not copyable at the moment. This could be changed if needed, however.

  int opApply(int delegate(ref T) dg);

    Foreach over values.

    Foreach will iterate over all elements in linear order from start to end.

  int opApply(int delegate(size_t, ref T) dg);

    Foreach over indices and values.

    Foreach will iterate over all elements in linear order from start to end.

  void opCatAssign(U : T)(U element);

    Append an element to the vector. (operator ~=)

  inout pure nothrow inout(T) opIndex(const size_t index);

    Get element at the specified index.

    Parameters:

    size_t index | Index of the element to get. Must be within bounds.

    Returns:
    Element at the specified index.
  void opIndexAssign(T value, const size_t index);

    Set element at the specified index.

    Parameters:

    size_t index | Index of the element to set. Must be within bounds.

  inout pure nothrow inout(T) front();

    Access the first element of the vector.

  inout pure nothrow inout(T) back();

    Access the last element of the vector.

  void popBack();

    Remove the last element of the vector.

  const pure nothrow size_t length();

    Get number of elements in the vector.

  const pure nothrow bool empty();

    Is the vector empty?

  void length(const size_t elements);

    Change length of the vector.

    If the length will be lower than current length, trailing elements will be erased. If higher, the vector will be expanded. Values of the extra elements after expansion are NOT defined.

    Parameters:

    size_t elements | length to set.

void unittestSegmentedVector();

  Unittest for SegmentedVector.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.