Flip Reference

 

Array Template Class Reference

Namespace

ohm::flip

Inherits from

ohm::flip::Object

Declared in

ohm/flip/Array.h

Companion Guide

Flip Programming Guide: Using Containers

Overview

The Array class implements an explicitely ordered container. The following sections will only document the public API.

A lot of methods use the ohm::flip::FindMask . The use of it is not exposed here but in the FindMask Enum Reference chapter as they are used by all the Flip containers.

Partial Class Diagram

Methods Overview

Accessing Elements

Capacity

Modifying

Iterators

Search

Differencing

Miscellaneous

Methods

front

Returns a reference to the first element of this, following the FindMask rule.

reference      front (FindMask find_mask = FindMask_NATURAL);
const_reference
               front (FindMask find_mask = FindMask_NATURAL) const;

back

Returns a reference to the last element of this, following the FindMask rule.

reference      back (FindMask find_mask = FindMask_NATURAL);
const_reference
               back (FindMask find_mask = FindMask_NATURAL) const;

empty

Returns true if this is empty, following the FindMask rule, false otherwise.

bool           empty (FindMask find_mask = FindMask_NATURAL) const;

size

Returns the number of elements of this, following the FindMask rule.

size_t         size (FindMask find_mask = FindMask_NATURAL) const;

insert

In the first version, insert an element of the type of the container, before it with arguments args .

In the second version, insert an element of the type U , before it with arguments args .

Returns the iterator to the inserted element.

iterator       insert (iterator it, Args & args = Args::_none);   // 1
template <class U>
iterator       insert (iterator it, Args & args = Args::_none);   // 2

Note:In the second version U must inherit of the element type of the container.

erase

In the first version, removes the element which iterator is it .

In the second version, removes the elements in the range [begin, end) .

void           erase (iterator it);                   // 1
void           erase (iterator begin, iterator end);  // 2

move

In the first version, move the element at src_it and put it before dst_it .

In the second version, move the elements at src_it from another array src_array and put it before dst_it .

Returns the iterator of the moved element.

iterator       move (iterator src_it, iterator dst_it);                    // 1
iterator       move (Array & src_array, iterator src_it, iterator dst_it); // 2

clear

Removes all the element from the container.

void           clear ();

This is equivalent to erase (begin (), end ())

begin

Returns an iterator to the first element of this, following the FindMask rule.

iterator       begin (FindMask find_mask = FindMask_NATURAL);
const_iterator begin (FindMask find_mask = FindMask_NATURAL) const;

end

Returns an iterator to element following the last element of this, following the FindMask rule.

iterator       end (FindMask find_mask = FindMask_NATURAL);
const_iterator end (FindMask find_mask = FindMask_NATURAL) const;

rbegin

Returns an reverse_iterator to the first element of this reversed, following the FindMask rule. This is the last element of the non-reversed container.

reverse_iterator
               rbegin (FindMask find_mask = FindMask_NATURAL);
const_reverse_iterator
               rbegin (FindMask find_mask = FindMask_NATURAL) const;

rend

Returns an reverse_iterator to element following the last element of this reversed, following the FindMask rule. This is the element preceding the first element of the non-reversed container.

reverse_iterator
               rend (FindMask find_mask = FindMask_NATURAL);
const_reverse_iterator
               rend (FindMask find_mask = FindMask_NATURAL) const;

find

In the first version, returns an iterator to the first element of this, following the FindMask rule, for which

it->operator == (elem) == true

In particular, T must support operator == .

In the second version, returns an iterator to the first element of this, following the FindMask rule, for which

predicate.equal (*it) == true

In particular, Predicate must conform to :

bool  equal (const T & object) const;
iterator       find (const T & elem, FindMask find_mask = FindMask_NATURAL);              // 1
const_iterator find (const T & elem, FindMask find_mask = FindMask_NATURAL) const;
template <class Predicate>
iterator       find (const Predicate & predicate, FindMask find_mask = FindMask_NATURAL); // 2
template <class Predicate>
const_iterator find (const Predicate & predicate, FindMask find_mask = FindMask_NATURAL) const;

rfind

In the first version, returns a reverse_iterator to the last element of this, following the FindMask rule, for which

it->operator == (elem) == true

In particular, T must support operator == .

In the second version, returns a reverse_iterator to the last element of this, following the FindMask rule, for which

predicate.equal (*it) == true

In particular, Predicate must conform to :

bool  equal (const T & object) const;
reverse_iterator
               rfind (const T & elem, FindMask find_mask = FindMask_NATURAL);                // 1
const_reverse_iterator
               rfind (const T & elem, FindMask find_mask = FindMask_NATURAL) const;
template <class Predicate>
reverse_iterator
               rfind (const Predicate & predicate, FindMask find_mask = FindMask_NATURAL);   // 2
template <class Predicate>
const_reverse_iterator
               rfind (const Predicate & predicate, FindMask find_mask = FindMask_NATURAL) const;

did_value_change

Returns true if this was changed, false otherwise. This is different from is_invalid in the sense that if the only change to a container is an element only, is_invalid will return true but did_value_change will return false .

bool           did_value_change () const;

did_child_order_change

Returns true if the order of elements in this was changed, false otherwise.

bool           did_child_order_change () const;

paste

Inserts an element using an ObjectMold and put it before it . Returns the iterator to the inserted element.

The second version maintains a mapping between the original Flip object reference numbers of the source object, and the Flip object reference numbers of the inserted object.

iterator       paste (iterator it, ObjectMold & mold);                           // 1
iterator       paste (iterator it, ObjectMold & mold, RefRefArr & ref_ref_arr);  // 2