26 #if ! defined (octave_unwind_prot_h)
27 #define octave_unwind_prot_h 1
29 #include "octave-config.h"
56 operator bool ()
const {
return ! empty (); }
63 std::unique_ptr<elem> ptr (m_lifo.top ());
73 elem *ptr = m_lifo.top ();
79 std::size_t
size ()
const {
return m_lifo.size (); }
85 m_lifo.push (new_elem);
101 void warn_unhandled_exception ()
const;
119 warn_unhandled_exception ();
166 template <
typename F,
typename... Args>
168 : m_fcn (std::bind (fcn, args...))
178 template <
typename F,
typename... Args>
179 void set (F&& fcn, Args&& ... args)
181 m_fcn = std::bind (fcn, args...);
184 void set () { m_fcn =
nullptr; }
200 std::function<void ()> m_fcn;
211 void warn_unhandled_exception ()
const;
220 template <
typename F,
typename... Args>
222 : m_fcn (std::bind (fcn, args...))
232 template <
typename F,
typename... Args>
233 void set (F&& fcn, Args&& ... args)
235 m_fcn = std::bind (fcn, args...);
238 void set () { m_fcn =
nullptr; }
252 warn_unhandled_exception ();
261 std::function<void ()> m_fcn;
298 template <
typename T>
307 : m_ref (ref), m_val (ref)
315 : m_ref (ref), m_val (ref)
333 OCTAVE_END_NAMESPACE(
octave)
unwind_action_safe(F &&fcn, Args &&... args)
void set(F &&fcn, Args &&... args)
void set(F &&fcn, Args &&... args)
unwind_action(F &&fcn, Args &&... args)
unwind_protect_var(T &ref, const T &new_val)
unwind_protect_var(T &ref)
virtual void add_action(elem *new_elem)
std::stack< elem * > m_lifo
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn