mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
fixed_iterator
|
|
An iterator where increments and decrements are null operations.
|
|
Can be used to copy to or from a fixed address such as a register.
|
|
|
|
See also: circular_iterator
|
|
____________________________________________________________________________________________________
|
|
Constructor
|
|
template <typename TIterator>
|
|
etl::fixed_iterator();
|
|
|
|
template <typename TIterator>
|
|
etl::fixed_iterator(TIterator it);
|
|
|
|
template <typename TIterator>
|
|
etl::fixed_iterator(const etl::fixed_iterator&);
|
|
____________________________________________________________________________________________________
|
|
Access
|
|
Titerator get() const;
|
|
Get the internal iterator.
|
|
|
|
void get(TIterator it);
|
|
Set the iterator.
|
|
____________________________________________________________________________________________________
|
|
Operators
|
|
typename etl::iterator_traits<TIterator>::value_type operator *()
|
|
const typename etl::iterator_traits<TIterator>::value_type operator *() const
|
|
Dereference operators
|
|
|
|
TIterator operator ->()
|
|
const TIterator operator ->() const
|
|
Member dereference operators
|
|
|
|
operator TIterator() const
|
|
Conversion operator
|
|
____________________________________________________________________________________________________
|
|
Example
|
|
etl::vector<char, 32> buffer;
|
|
|
|
const char* UART_READ = (const char*) 0x1000;
|
|
const char* UART_WRITE = (const char*) 0x1001;
|
|
|
|
etl::fixed_iterator<char*> uart_read(UART_READ);
|
|
etl::fixed_iterator<char*> uart_write(UART_WRITE);
|
|
|
|
// Read 20 characters from the port.
|
|
std::copy_n(uart_read, 20, std::back_inserter<char>(buffer));
|
|
|
|
// Write the buffer of characters to the port.
|
|
std::copy(buffer.begin(), buffer.end(), uart_write);
|
|
|