Пространства имён
Варианты
Действия

std::ostream_iterator::ostream_iterator

Материал из cppreference.com

<metanoindex/>

 
 
Библиотека итераторов
Концепты итераторов
Примитивы итераторов
Концепты алгоритмов и утилиты
Косвенно вызываемые концепты
Общие требования к алгоритмам
Утилиты
(C++20)
Адаптеры итераторов
Потоковые итераторы
Точки настройки итераторов
Операции итераторов
(C++11)
(C++11)
Доступ к диапазону
(C++11)(C++14)
(C++11)(C++14)
(C++17)(C++20)
(C++14)(C++14)
(C++14)(C++14)
(C++17)
(C++17)
 
std::ostream_iterator
Член функций
Оригинал:
Member functions
Текст был переведён автоматически используя Переводчик Google.
Вы можете проверить и исправить перевод. Для инструкций щёлкните сюда.
 
<tbody> </tbody>
ostream_iterator(ostream_type& buffer, const CharT* delim)
(1)
ostream_iterator(ostream_type& stream)
(2)

1) Constructs the iterator with the private ostream_type* member initialized with &stream and the private delimiter pointer initialized with delim.

2) Constructs the iterator with the private ostream_type* member initialized with &stream and the private delimiter pointer initialized with null pointer value.

Параметры

stream the output stream to be accessed by this iterator
delim the null-terminated character string to be inserted into the stream after each output

Пример

#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
    std::ostream_iterator<int> i1(std::cout, ", ");
    std::fill_n(i1, 5, -1);
    std::ostream_iterator<double> i2(std::cout);
    *i2++ = 3.14;
}

Вывод:

-1, -1, -1, -1, -1, 3.14