| Home | Libraries | People | FAQ | More

### Construct, copy, destruct

Construct, copy, destruct | intervals | interval sets | interval maps | element sets | element maps
--- | --- | --- | --- | --- | ---
`T::T()` | 1 | 1 | 1 | 1 | 1
`T::T(const P&)` | A | e i S | b p M | 1 | 1
`T& T::operator=(const P&)` | A | S | M | 1 | 1
`void T::swap(T&)` |  | 1 | 1 | 1 | 1

All icl types are regular types. They are default constructible, copy constructible and assignable. On icl Sets and Maps a `swap` function is available, that allows for constant time swapping of container contents. The regular and swappable part of the basic functions and their complexities are described in the tables below.

Regular and swap | intervals | interval sets | interval maps | element sets | element maps
--- | --- | --- | --- | --- | ---
`T::T()` | O(1) | O(1) | O(1) | O(1) | O(1)
`T::T(const T&)` | O(1) | O(n) | O(n) | O(n) | O(n)
`T& T::operator=(const T&)` | O(1) | O(n) | O(n) | O(n) | O(n)
`void T::swap(T&)` |  | O(1) | O(1) | O(1) | O(1)

where n `= iterative_size(x)`.

Construct, copy, destruct | Description
--- | ---
`T::T()` | Object of type T is default constructed.
`T::T(const T& src)` | Object of type T is copy constructed from object `src`.
`T& T::operator=(const T& src)` | Assigns the contents of src to `*this` object. Returns a reference to the assigned object.
`void T::swap(T& src)` | Swaps the content containers `*this` and `src` in constant time.

In addition we have overloads of constructors and assignment operators for icl container types.

    // overload tables for constructors
    T::T(const P& src)

    element containers:     interval containers:
    T \ P | e b s m         T \ P | e i b p S M
    ------+--------         ------+------------
    s     | s   s           S     | S S     S
    m     |   m   m         M     |     M M   M

For an object `dst` of type `T` and an argument `src` of type `P` let

    n = iterative_size(dst);
    m = iterative_size(src);

in the following tables.

Table 1.17. Time Complexity for overloaded constructors on element containers

`T(const P& src)` | domain type | domain mapping type | interval sets | interval maps
--- | --- | --- | --- | ---
`std::set` | O(log n) |  | O(m) |
`icl::map` |  | O(log n) |  | O(m)

Time complexity characteristics of inplace insertion for interval containers is given by this table.

Table 1.18. Time Complexity for overloaded constructors on interval containers

`T(const P& src)` | domain type | interval type | domain mapping type | interval mapping type | interval sets | interval maps
--- | --- | --- | --- | --- | --- | ---
interval_sets | O(1) | O(1) |  |  | O(m) |
interval_maps |  |  | O(1) | O(1) |  | O(m)

    // overload tables for assignment
    T& operator = (const P& src)

    interval containers:
    T \ P | S M
    ------+----
    S     | S
    M     |   M

The assignment `T& operator = (const P& src)` is overloaded within interval containers. For all type combinations we have linear time complexity in the maximum of the `iterative_size` of `dst` and `src`.

Back to section . . .

Function Synopsis
Interface