
please wait
|
|
in.rdbuf()
returns (a pointer to) the stream buffer associated with the stream in.out << in.rdbuf()
extracts characters one by one from the input sequence controlled by the stream buffer and writes them into out till eof occurs on input, or the output fails.explicit operator bool() const
&& out
part is just to provide a boolean context.return bool( out << in.rdbuf() ) ;
return !( out << in.rdbuf() ).fail() ;
First of all there are things that just can’t be done right without exceptions. Consider an error detected in a constructor; how do you report the error? You throw an exception. That’s the basis of RAII (Resource Acquisition Is Initialization), which is the basis of some of the most effective modern C++ design techniques: A constructor’s job is to establish the invariants for the class (create the environment in which the member functions are to run) and that often requires the acquisition of resources, such as memory, locks, files, sockets, etc. https://isocpp.org/wiki/faq/exceptions |