Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::error_detail::Message_Stream Class Reference

The stream of the message of a macro that throws. More...

#include <ah-errors.H>

Collaboration diagram for Aleph::error_detail::Message_Stream:
[legend]

Public Member Functions

 Message_Stream (const char *file, const int line)
 Makes the stream and writes in it the place of the error.
 
 ~Message_Stream ()
 Frees the stream.
 
 Message_Stream (const Message_Stream &)=delete
 A message has one stream: it is not copied.
 
Message_Stream & operator= (const Message_Stream &)=delete
 A message has one stream: it is not assigned.
 
std::ostringstream && stream () noexcept
 The stream, as the temporary stream of a macro was.
 

Private Attributes

std::ostringstream * stream_ = nullptr
 

Detailed Description

The stream of the message of a macro that throws.

A macro wrote its message in a temporary std::ostringstream, which lived in the frame of the function that checks: 376 bytes with libstdc++ on x86-64, and GCC does not inline a function whose frame grows so. This object owns the stream out of that frame, of which it takes a pointer, and frees it when the full expression of the macro ends, which is when its exception leaves.

stream() gives the stream as the temporary was, an rvalue of the same type: the items of a macro are written by the same insertions, at the same time and with the same types as before. The place of the error is written here, by the inserters of the standard library and before any item is evaluated.

Definition at line 170 of file ah-errors.H.

Constructor & Destructor Documentation

◆ Message_Stream() [1/2]

Aleph::error_detail::Message_Stream::Message_Stream ( const char *  file,
const int  line 
)
inline

Makes the stream and writes in it the place of the error.

Parameters
[in]fileThe file of the call, as __FILE__ gives it.
[in]lineThe line of the call.
Exceptions
std::bad_allocIf there is no memory for the stream; the macro has not evaluated any of its items then.

Definition at line 181 of file ah-errors.H.

References file, and stream_.

◆ ~Message_Stream()

Aleph::error_detail::Message_Stream::~Message_Stream ( )
inline

Frees the stream.

Definition at line 196 of file ah-errors.H.

References stream_.

◆ Message_Stream() [2/2]

Aleph::error_detail::Message_Stream::Message_Stream ( const Message_Stream &  )
delete

A message has one stream: it is not copied.

Member Function Documentation

◆ operator=()

Message_Stream & Aleph::error_detail::Message_Stream::operator= ( const Message_Stream &  )
delete

A message has one stream: it is not assigned.

◆ stream()

std::ostringstream && Aleph::error_detail::Message_Stream::stream ( )
inlinenoexcept

The stream, as the temporary stream of a macro was.

Returns
The stream of the message, as an rvalue.

Definition at line 207 of file ah-errors.H.

Member Data Documentation

◆ stream_

std::ostringstream* Aleph::error_detail::Message_Stream::stream_ = nullptr
private

Definition at line 172 of file ah-errors.H.

Referenced by Message_Stream(), and ~Message_Stream().


The documentation for this class was generated from the following file: