rcbuchanan
rcbuchanan

Reputation: 163

Where is "my_ifstream >> my_char" documented?

I'm using "cin >> my_char" to drop a ':' in an input record I'm trying to parse. Here is a minimal example.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;

int main () {
    char c;
    int x, y;

    cin >> hex >> x >> hex >> c >> y;
    cout << "x = " << x << "\ny = " << y << "\n";
}

And example usage:

rc@timecube:/tmp$ g++ test.cpp && echo "0000a:ffff" | ./a.out 
x = 10
y = 65535

This code does exactly what I want, but I don't understand why. I expected to see something like:

istream& operator>> (char& val);

in the istream reference here, but I don't.

So how is this behavior documented?

Upvotes: 2

Views: 47

Answers (1)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385264

Under the free functions.

Not all operators are members!

Upvotes: 7

Related Questions