https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
infix_ostream_iterator< T, charT, traits > Class Template Reference

GCC9 currently hits a "no type named 'value_type'" error during build if this is removed and iterator traits are listed within the class corresponding to the C++17 standard. More...

#include <InfixIterator.h>

Inheritance diagram for infix_ostream_iterator< T, charT, traits >:
[legend]

Public Types

typedef charT char_type
 
typedef traits traits_type
 
typedef std::basic_ostream< charT, traits > ostream_type
 

Public Member Functions

 infix_ostream_iterator (ostream_type &s)
 
 infix_ostream_iterator (ostream_type &s, charT const *d, bool first=true)
 
infix_ostream_iterator< T, charT, traits > & operator= (T const &item)
 
infix_ostream_iterator< T, charT, traits > & operator* ()
 
infix_ostream_iterator< T, charT, traits > & operator++ ()
 
infix_ostream_iterator< T, charT, traits > & operator++ (int)
 

Private Types

using iterator_category = std::output_iterator_tag
 

Private Attributes

std::basic_ostream< charT, traits > * os
 
charT const * delimiter
 
bool first_elem
 

Detailed Description

template<class T, class charT = char, class traits = std::char_traits<charT>>
class infix_ostream_iterator< T, charT, traits >

GCC9 currently hits a "no type named 'value_type'" error during build if this is removed and iterator traits are listed within the class corresponding to the C++17 standard.

This preserves use of std::iterator for GCC9 and earlier.

Definition at line 20 of file InfixIterator.h.

Member Typedef Documentation

◆ char_type

template<class T , class charT = char, class traits = std::char_traits<charT>>
typedef charT infix_ostream_iterator< T, charT, traits >::char_type

Definition at line 39 of file InfixIterator.h.

◆ iterator_category

template<class T , class charT = char, class traits = std::char_traits<charT>>
using infix_ostream_iterator< T, charT, traits >::iterator_category = std::output_iterator_tag
private

Definition at line 31 of file InfixIterator.h.

◆ ostream_type

template<class T , class charT = char, class traits = std::char_traits<charT>>
typedef std::basic_ostream<charT, traits> infix_ostream_iterator< T, charT, traits >::ostream_type

Definition at line 41 of file InfixIterator.h.

◆ traits_type

template<class T , class charT = char, class traits = std::char_traits<charT>>
typedef traits infix_ostream_iterator< T, charT, traits >::traits_type

Definition at line 40 of file InfixIterator.h.

Constructor & Destructor Documentation

◆ infix_ostream_iterator() [1/2]

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits >::infix_ostream_iterator ( ostream_type s)
inline

Definition at line 42 of file InfixIterator.h.

42: os(&s), delimiter(0), first_elem(true) {}
charT const * delimiter
std::basic_ostream< charT, traits > * os

◆ infix_ostream_iterator() [2/2]

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits >::infix_ostream_iterator ( ostream_type s,
charT const *  d,
bool  first = true 
)
inline

Definition at line 43 of file InfixIterator.h.

44 : os(&s), delimiter(d), first_elem(first)
45 {
46 }

Member Function Documentation

◆ operator*()

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits > & infix_ostream_iterator< T, charT, traits >::operator* ( )
inline

Definition at line 57 of file InfixIterator.h.

57{ return *this; }

◆ operator++() [1/2]

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits > & infix_ostream_iterator< T, charT, traits >::operator++ ( )
inline

Definition at line 58 of file InfixIterator.h.

58{ return *this; }

◆ operator++() [2/2]

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits > & infix_ostream_iterator< T, charT, traits >::operator++ ( int  )
inline

Definition at line 59 of file InfixIterator.h.

59{ return *this; }

◆ operator=()

template<class T , class charT = char, class traits = std::char_traits<charT>>
infix_ostream_iterator< T, charT, traits > & infix_ostream_iterator< T, charT, traits >::operator= ( T const &  item)
inline

Definition at line 47 of file InfixIterator.h.

48 {
49 // Here's the only real change from ostream_iterator:
50 // Normally, the '*os << item;' would come before the 'if'.
51 if (!first_elem && delimiter != 0)
52 *os << delimiter;
53 *os << item;
54 first_elem = false;
55 return *this;
56 }

Member Data Documentation

◆ delimiter

template<class T , class charT = char, class traits = std::char_traits<charT>>
charT const* infix_ostream_iterator< T, charT, traits >::delimiter
private

◆ first_elem

template<class T , class charT = char, class traits = std::char_traits<charT>>
bool infix_ostream_iterator< T, charT, traits >::first_elem
private

◆ os

template<class T , class charT = char, class traits = std::char_traits<charT>>
std::basic_ostream<charT, traits>* infix_ostream_iterator< T, charT, traits >::os
private

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