libdl  0.0.1
Simple yet powerful deep learning
Loading...
Searching...
No Matches
dl::utils::LineIterator Struct Referencefinal

Public Types

using iterator_category = std::input_iterator_tag
 
using value_type = std::string
 
using difference_type = std::ptrdiff_t
 
using reference = const value_type &
 
using pointer = const value_type *
 

Public Member Functions

 LineIterator (std::istream &input)
 
reference operator* () const
 
pointer operator-> () const
 
LineIteratoroperator++ ()
 
LineIterator operator++ (int)
 

Friends

bool operator== (const LineIterator &x, const LineIterator &y)
 
bool operator!= (const LineIterator &x, const LineIterator &y)
 

Detailed Description

Definition at line 8 of file line_iter.hpp.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

◆ pointer

Definition at line 13 of file line_iter.hpp.

◆ reference

Definition at line 12 of file line_iter.hpp.

◆ value_type

Definition at line 10 of file line_iter.hpp.

Constructor & Destructor Documentation

◆ LineIterator() [1/2]

dl::utils::LineIterator::LineIterator ( )
inline

Definition at line 15 of file line_iter.hpp.

15: input_(nullptr) {}

◆ LineIterator() [2/2]

dl::utils::LineIterator::LineIterator ( std::istream input)
inline

Definition at line 16 of file line_iter.hpp.

16: input_(&input) { ++*this; }

Member Function Documentation

◆ operator*()

reference dl::utils::LineIterator::operator* ( ) const
inline

Definition at line 18 of file line_iter.hpp.

18{ return s_; }

◆ operator++() [1/2]

LineIterator & dl::utils::LineIterator::operator++ ( )
inline

Definition at line 21 of file line_iter.hpp.

21 {
22 if (!std::getline(*input_, s_))
23 input_ = nullptr;
24 return *this;
25 }
T getline(T... args)

◆ operator++() [2/2]

LineIterator dl::utils::LineIterator::operator++ ( int  )
inline

Definition at line 27 of file line_iter.hpp.

27 {
28 auto copy(*this);
29 ++*this;
30 return copy;
31 }
T copy(T... args)

◆ operator->()

pointer dl::utils::LineIterator::operator-> ( ) const
inline

Definition at line 19 of file line_iter.hpp.

19{ return &**this; }

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const LineIterator x,
const LineIterator y 
)
friend

Definition at line 35 of file line_iter.hpp.

35{ return !(x == y); }

◆ operator==

bool operator== ( const LineIterator x,
const LineIterator y 
)
friend

Definition at line 33 of file line_iter.hpp.

33{ return x.input_ == y.input_; }

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