Node:C++ Formatted Input, Previous:Formatted Input Functions, Up:Formatted Input
The following functions are provided in libgmpxx
, which is built only
if C++ support is enabled (see Build Options). Prototypes are available
from <gmp.h>
.
istream& operator>> (istream& stream, mpz_t rop) | Function |
Read rop from stream, using its ios formatting settings.
|
istream& operator>> (istream& stream, mpq_t rop) | Function |
Read rop from stream, using its ios formatting settings.
An integer like |
istream& operator>> (istream& stream, mpf_t rop) | Function |
Read rop from stream, using its ios formatting settings.
Hex or octal floats are not supported, but might be in the future. |
These operators mean that GMP types can be read in the usual C++ way, for
example,
mpz_t z; ... cin >> z;
But note that istream
input (and ostream
output, see C++ Formatted Output) is the only overloading available and using for instance
+
with an mpz_t
will have unpredictable results.