public member function
<iterator>
std::istream_iterator::operator*reference operator*() const;
Dereference iterator
Returns a reference to the element pointed by the iterator.Internally, the function returns the value the object stores as its current element.
If the iterator has just been constructed from an input stream, and the implementation of that operation did not extract a value form the stream on construction, it is now extracted.
If the iterator is an end-of-stream iterator it shall not be dereferenced.
const value_type&
, where value_type is the type of the elements extracted by the operator (the first class template parameter).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// istream_iterator example
#include <iostream> // std::cin, std::cout
#include <iterator> // std::istream_iterator
int main () {
double value1, value2;
std::cout << "Please, insert two values: ";
std::istream_iterator<double> eos; // end-of-stream iterator
std::istream_iterator<double> iit (std::cin); // stdin iterator
if (iit!=eos) value1=*iit;
++iit;
if (iit!=eos) value2=*iit;
std::cout << value1 << "*" << value2 << "=" << (value1*value2) << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4