| Home | Libraries | People | FAQ | More

#### rows_view

A non-owning read-only reference to a sequence of rows.

##### Synopsis

Defined in header `<boost/mysql/rows_view.hpp>`

    class rows_view;

##### Types

Name | Description
--- | ---
const_iterator | A random access iterator to an element.
const_reference | The reference type.
difference_type | A signed integer type used to represent differences.
iterator | A random access iterator to an element.
reference | The reference type.
size_type | An unsigned integer type to represent sizes.
value_type | A type that can hold elements in this collection with value semantics.

##### Member Functions

Name | Description
--- | ---
at | Returns the i-th row or throws an exception.
back | Returns the last row.
begin | Returns an iterator to the first element in the collection.
empty | Returns true if there are no rows in the collection (i.e. `this->size() == 0`)
end | Returns an iterator to one-past-the-last element in the collection.
front | Returns the first row.
num_columns | Returns the number of elements each row in the collection has.
operator!= | Inequality operator.
operator== | Equality operator.
operator[] | Returns the i-th row (unchecked access).
rows_view [constructor] | Construct an empty (but valid) view.
size | Returns the number of rows in the collection.

##### Description

Models a non-owning matrix-like container. Indexing a `rows_view` object (by using iterators, `rows_view::at` or `rows_view::operator[]`) returns a `row_view` object, representing a single row. All rows in the collection are the same size (as given by `num_columns`).

A `rows_view` object points to memory owned by an external entity (like `string_view` does). The validity of a `rows_view` object depends on how it was obtained:

- If it was constructed from a `rows` object (by calling `rows::operator rows_view()`), the view acts as a reference to the `rows`' allocated memory, and is valid as long as references to that `rows` elements are valid.
- If it was obtained by calling `connection::read_some_rows` it's valid until the `connection` performs the next network call or is destroyed.

`row_view`'s and `field_view`'s obtained by using a `rows_view` object are valid as long as the underlying storage that `*this` points to is valid. Destroying `*this` doesn't invalidate such references.

Calling any member function on an invalid view results in undefined behavior.

Instances of this class are usually created by the library, not by the user.

Convenience header `<boost/mysql.hpp>`