FastLED 3.9.15
Loading...
Searching...
No Matches
fl::back_insert_iterator< Container > Class Template Reference

Detailed Description

template<typename Container>
class fl::back_insert_iterator< Container >

Back insert iterator - an output iterator that inserts elements at the end of a container.

This is similar to std::back_insert_iterator and provides a convenient way to insert elements into containers that support push_back() (like fl::vector, fl::FixedVector, fl::InlinedVector).

Usage example:

auto inserter = fl::back_inserter(vec);
*inserter++ = 10;
*inserter++ = 20;
*inserter++ = 30;
// vec now contains [10, 20, 30]
back_insert_iterator< Container > back_inserter(Container &c) FL_NOEXCEPT
Helper function to create a back_insert_iterator.
Definition iterator.h:139

Or use in algorithm-style iteration:

fl::vector<int> source = {1, 2, 3, 4, 5};
auto inserter = fl::back_inserter(dest);
for (auto it = source.begin(); it != source.end(); ++it) {
*inserter++ = *it;
}
// dest now contains [1, 2, 3, 4, 5]
iterator begin() FL_NOEXCEPT
Definition vector.h:655
iterator end() FL_NOEXCEPT
Definition vector.h:661

Definition at line 75 of file iterator.h.

#include <iterator.h>

Public Types

typedef Container container_type
 
typedef Container::value_type container_value_type
 
typedef void difference_type
 
typedef void iterator_category
 
typedef void pointer
 
typedef void reference
 
typedef void value_type
 

Public Member Functions

 back_insert_iterator (Container &c) FL_NOEXCEPT
 
back_insert_iteratoroperator* () FL_NOEXCEPT
 
back_insert_iteratoroperator++ () FL_NOEXCEPT
 
back_insert_iterator operator++ (int) FL_NOEXCEPT
 
template<typename T>
back_insert_iteratoroperator= (const T &value) FL_NOEXCEPT
 
template<typename T>
back_insert_iteratoroperator= (T &&value) FL_NOEXCEPT
 

Protected Attributes

Container * container
 

The documentation for this class was generated from the following file: