SpECTRE  v2024.04.12
ScopedFpeState Class Reference

An RAII object to temporarily modify the handling of floating point exceptions. More...

#include <FloatingPointExceptions.hpp>

Classes

struct  DoNotSave
 

Public Member Functions

 ScopedFpeState (const ScopedFpeState &)=delete
 
 ScopedFpeState (ScopedFpeState &&)=delete
 
ScopedFpeStateoperator= (const ScopedFpeState &)=delete
 
ScopedFpeStateoperator= (ScopedFpeState &&)=delete
 
 ScopedFpeState ()
 Start a scope that will be restored, without changing the current state.
 
 ScopedFpeState (bool exceptions_enabled)
 Start a scope with the specified exception state. This is equivalent to calling the default constructor followed by set_exceptions.
 
 ScopedFpeState (DoNotSave)
 Start a scope without saving the current state. The only valid method call from this state is save_exceptions.
 
void set_exceptions (bool exceptions_enabled) const
 Enable or disable floating point exceptions. It is an error if the exception state is not currently saved.
 
void save_exceptions ()
 Save the current exception handling state after it has been cleared by restore_exceptions. It will be restored by a later call to restore_exceptions. It is an error to call this if a state is already saved.
 
void restore_exceptions ()
 Restore the FPE handling to the internally saved state if present and clear that state. This is called automatically by the destructor if it is not called manually.
 

Detailed Description

An RAII object to temporarily modify the handling of floating point exceptions.


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