Library Version 12.1.6.2

Chapter 7. Db_set
Prev |  | Next

## Chapter 7. Db_set

This class is the combination of std::set and hash_set.

By setting database handles of DB_BTREE or DB_HASH type, you will be using the equivalent of std::set or hash_set. This container stores the key in the key element of a key/data pair in the underlying database, but doesn't store anything in the data element. Database and environment handle requirement: The same as that of db_map .

#### See Also

db_map db_container

### Class Template Parameters

#### kdt

The key data type.

#### value_type_sub

If kdt is a class/struct type, do not specify anything in this parameter; Otherwise specify ElementHolder<kdt>.

#### Public Members

Member | Description
--- | ---
db_set | Create a std::set/hash_set equivalent associative container.
~db_set |
insert | Insert a single key/data pair if the key is not in the container.
operator= | Container content assignment operator.
value_comp | Get value comparison functor.
swap | Swap content with another container.
operator== | Set content equality comparison operator.
operator!= | Inequality comparison operator.

#### Group

Dbstl Container Classes

## db_set

### Function Details

    db_set(Db *dbp=NULL,
        DbEnv *envp=NULL)

Create a std::set/hash_set equivalent associative container.

See the handle requirement in class details to pass correct database/environment handles.

#### Parameters

##### dbp

The database handle.

##### envp

The database environment handle.

#### See Also

db_map(Db*, DbEnv*) db_container(Db*, DbEnv*)

    db_set(Db *dbp, DbEnv *envp, InputIterator first,
        InputIterator last)

Iteration constructor.

Iterates between first and last, copying each of the elements in the range into this container. Create a std::set/hash_set equivalent associative container. Insert a range of elements into the database. The range is [first, last), which contains elements that can be converted to type ddt automatically. This function supports auto-commit. See the handle requirement in class details to pass correct database/environment handles.

#### Parameters

##### dbp

The database handle.

##### envp

The database environment handle.

##### last

The open boundary of the range.

##### first

The closed boundary of the range.

#### See Also

db_map(Db*, DbEnv*, InputIterator, InputIterator)

    db_set(const self &x)

Copy constructor.

Create a database and insert all key/data pairs in x into this container. x's data members are not copied. This function supports auto-commit.

#### Parameters

##### x

The source container to initialize this container.

#### See Also

db_map(const db_map&) db_container(const db_container&)

### Class

db_set

Prev |  | Next
operator!= | Home | ~db_set