std::experimental::make_ostream_joiner
From cppreference.com
< cpp | experimental | ostream joiner
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Experimental
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
std::experimental::ostream_joiner
Member functions
Non-member functions
make_ostream_joiner
Defined in header
<experimental/iterator>
template< class CharT, class Traits, class DelimT >
(library fundamentals TS v2)
std::experimental::ostream_joiner <std::decay_t <DelimT>, CharT, Traits>
make_ostream_joiner( std::basic_ostream <CharT, Traits>& os,
Creates an ostream_joiner
object, deducing the template arguments from the types of the function arguments.
[edit] Parameters
os
-
the
basic_ostream
object that the iterator is to be associated to
delimiter
-
the delimiter
[edit] Return value
An ostream_joiner
object, created as if by std::experimental::ostream_joiner <std::decay_t <DelimT>, CharT, Traits>(os, std::forward <DelimT>(delimiter))
[edit] Example
Run this code
#include <experimental/iterator> #include <iostream> #include <vector> int main() { std::vector <int> x{1, 2, 3, 4}; std::copy (x.begin(), x.end(), std::experimental::make_ostream_joiner(std::cout, ", ")); }
Output:
1, 2, 3, 4