26#if ! defined (octave_unwind_prot_h)
27#define octave_unwind_prot_h 1
29#include "octave-config.h"
54 operator bool ()
const {
return ! empty (); }
61 std::unique_ptr<elem> ptr (m_lifo.top ());
71 elem *ptr = m_lifo.top ();
77 std::size_t
size ()
const {
return m_lifo.size (); }
83 m_lifo.push (new_elem);
97 void warn_unhandled_exception ()
const;
115 warn_unhandled_exception ();
162 template <
typename F,
typename... Args>
164 : m_fcn (std::bind (fcn, args...))
174 template <
typename F,
typename... Args>
175 void set (F&& fcn, Args&& ... args)
177 m_fcn = std::bind (fcn, args...);
180 void set () { m_fcn =
nullptr; }
196 std::function<void ()> m_fcn;
207 void warn_unhandled_exception ()
const;
216 template <
typename F,
typename... Args>
218 : m_fcn (std::bind (fcn, args...))
228 template <
typename F,
typename... Args>
229 void set (F&& fcn, Args&& ... args)
231 m_fcn = std::bind (fcn, args...);
234 void set () { m_fcn =
nullptr; }
248 warn_unhandled_exception ();
257 std::function<void ()> m_fcn;
303 : m_ref (ref), m_val (ref)
311 : m_ref (ref), m_val (ref)
329OCTAVE_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