insert
Prev | Chapter 5. Db_map | Next

## insert

### Function Details

    insert(const value_type &x)

Insert a single key/data pair if the key is not in the container.

#### Parameters

##### x

The key/data pair to insert.

#### Return Value

A pair P, if insert OK, i.e. the inserted key wasn't in the container, P.first will be the iterator sitting on the inserted key/data pair, and P.second is true; otherwise P.first is an invalid iterator and P.second is false.

    iterator insert(iterator position,
        const value_type &x)

Insert with hint position.

We ignore the hint position because Berkeley DB knows better where to insert.

#### Parameters

##### position

The hint position.

##### x

The key/data pair to insert.

#### Return Value

The iterator sitting on the inserted key/data pair, or an invalid iterator if the key was already in the container.

    void insert(const db_map_base_iterator< kdt, realddt, ddt > &first,
        const db_map_base_iterator< kdt, realddt,
        ddt > &last)

Range insertion.

Insert a range [first, last) of key/data pairs into this container.

#### Parameters

##### last

The open boundary of the range.

##### first

The closed boundary of the range.

    void insert(InputIterator first,
        InputIterator last)

Range insertion.

Insert a range [first, last) of key/data pairs into this container.

#### Parameters

##### last

The open boundary of the range.

##### first

The closed boundary of the range.

### Group: Insert Functions

They have similiar usage as their C++ STL equivalents.

Note that when secondary index is enabled, each db_container can create a db_multimap secondary container, but the insert function is not functional for secondary containers.

http://www.cplusplus.com/reference/stl/map/insert/

### Class

db_map

Prev | Up | Next
~db_map | Home | begin