begin()

| Home | Libraries | People | FAQ | More

##### begin()

Returns the iterator pointing at the begin of the rtree values range.

###### Description

This method returns the iterator which may be used to iterate over all values stored in the rtree.

###### Synopsis

    const_iterator begin()

###### Modifier(s)

    const

###### Returns

The iterator pointing at the begin of the range.

###### Example

    // Copy all values into the vector
    std::copy(tree.begin(), tree.end(), std::back_inserter(vec));

    for ( Rtree::const_iterator it = tree.begin() ; it != tree.end() ; ++it )
    {
        // do something with value
    }

    // C++11 (auto)
    for ( auto it = tree.begin() ; it != tree.end() ; ++it )
    {
        // do something with value
    }

    // C++14 (generic lambda expression)
    std::for_each(tree.begin(), tree.end(), [](auto const& val){
        // do something with value
    })

###### Iterator category

ForwardIterator

###### Throws

If allocation throws.

| Warning
The modification of the rtree may invalidate the iterators.