Reference: The C++ Standard Library: A Tutorial and Reference
Saturday, May 15, 2010
Stream's failbit
If a stream's failbit is set, every operation on that stream is a no-op until the failbit is cleared.
Reference: The C++ Standard Library: A Tutorial and Reference
by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 599.
Reference: The C++ Standard Library: A Tutorial and Reference
Wednesday, May 12, 2010
Exceptions
After catching an exception with catch (...){}, you can get the what() data if you rethrow the exception and catch it with an exception type.
Monday, May 10, 2010
cin
The following are member functions of cin: get(), getline(), read() and readsome().
Reference: The C++ Standard Library: A Tutorial and Reference
by Nicolai M. Josuttis Addison-Wesley, 1999, p. 607.
Reference: The C++ Standard Library: A Tutorial and Reference
Saturday, May 8, 2010
Argument Dependent Lookup (ADL)
The following code compiles:
Reference: The C++ Standard Library: A Tutorial and Reference
by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 613.
#include <iostream>
int main() {endl(std::cout);}
Note that there is no 'std::' in front of endl and endl is being called like a function. Since the parameter to endl specifies the namespace, ADL (Argument Dependent Lookup aka Koenig Look) looks first for the function in the namespace of the parameter, which in this case is std. It is nicer to specify the 'std::' though.Reference: The C++ Standard Library: A Tutorial and Reference
Thursday, May 6, 2010
Stream's imbue() member function
A stream's imbue() member function sets the locale object.
Reference: "The C++ Standard Library"
by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 626.
Reference: "The C++ Standard Library"
Wednesday, May 5, 2010
ios_base flags
ios_base flags to the C Mode flags mapping: in->"r", out or out|trunc->"w", out|app->"a",in|out->"r+",in|out|trunc->"w+"
Reference: C++ Standard Library, The: A Tutorial and Reference, MobiPocket
by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 632.
Reference: C++ Standard Library, The: A Tutorial and Reference, MobiPocket
Sunday, May 2, 2010
Streams
If you close then re-open a stream, the stream's state flags are not cleared.
Reference: The C++ Standard Library: A Tutorial and Reference
by Nicolai M. Josuttis. Addison-Wesley, 1999, p. 634.
Reference: The C++ Standard Library: A Tutorial and Reference
Subscribe to:
Posts (Atom)
