183 other.active =
false;
197 other.active =
false;
226 Node * p = it.get_curr();
237 Arc * a = it.get_curr();
350 other.active =
false;
366 other.active =
false;
421 [[
nodiscard]]
const std::vector<std::pair<Node*, void*>> &
431 [[
nodiscard]]
const std::vector<std::pair<Arc*, void*>> &
451 Node * p = it.get_curr();
461 Arc * a = it.get_curr();
491template <
class GT,
class Func>
495 return std::forward<Func>(func)();
523template <
class GT,
class Func>
527 return std::forward<Func>(func)();
558template <
class GT,
class Cleanup>
584 other.active =
false;
618template <
class GT,
class Cleanup>
RAII guard that clears graph cookies on destruction.
Cookie_Guard(const GT &g, bool _clear_nodes=true, bool _clear_arcs=true) noexcept
Construct a cookie guard for the given graph.
void release() noexcept
Release the guard without clearing cookies.
Cookie_Guard(const GT &g, Node_Deleter nd, Arc_Deleter ad=nullptr) noexcept
Construct with custom deleters for cookie data.
void clear_now()
Manually trigger cleanup now.
Cookie_Guard & operator=(Cookie_Guard &&other) noexcept
Move assignment transfers ownership.
Cookie_Guard(Cookie_Guard &&other) noexcept
Move construction transfers ownership.
std::function< void(Arc *)> Arc_Deleter
Signature for custom arc cookie deleter.
Cookie_Guard & operator=(const Cookie_Guard &)=delete
Cookie_Guard(const Cookie_Guard &)=delete
Copying disabled.
Node_Deleter node_deleter
~Cookie_Guard()
Destructor - clears cookies if guard is still active.
std::function< void(Node *)> Node_Deleter
Signature for custom node cookie deleter.
RAII guard that saves and restores graph cookies.
const std::vector< std::pair< Node *, void * > > & get_saved_node_cookies() const noexcept
Get access to saved node cookies.
std::function< void(Arc *)> Arc_Cleanup
Signature for custom cleanup of temporary arc cookies.
std::vector< std::pair< Arc *, void * > > saved_arc_cookies
Cookie_Saver(const Cookie_Saver &)=delete
Copying disabled.
const std::vector< std::pair< Arc *, void * > > & get_saved_arc_cookies() const noexcept
Get access to saved arc cookies.
std::function< void(Node *)> Node_Cleanup
Signature for custom cleanup of temporary node cookies.
std::vector< std::pair< Node *, void * > > saved_node_cookies
Node_Cleanup node_cleanup
Cookie_Saver(const GT &g, bool _save_nodes=true, bool _save_arcs=true)
Construct a cookie saver for the given graph.
void discard() noexcept
Discard saved cookies without restoring.
Cookie_Saver(Cookie_Saver &&other) noexcept
Move construction transfers ownership.
Cookie_Saver & operator=(Cookie_Saver &&other) noexcept
Move assignment transfers ownership.
Cookie_Saver(const GT &g, Node_Cleanup nc, Arc_Cleanup ac=nullptr)
Construct with custom cleanup for temporary cookies.
Cookie_Saver & operator=(const Cookie_Saver &)=delete
~Cookie_Saver()
Destructor - restores cookies if saver is still active.
void restore_now()
Manually restore cookies now.
Graph_Node< int > Node
The graph type.
Graph_Arc< int > Arc
The node class type.
Generic RAII scope guard for cleanup operations on graphs.
Scope_Guard(const GT &g, Cleanup cleanup)
Construct a scope guard.
Scope_Guard(Scope_Guard &&other) noexcept
Move construction transfers ownership.
Scope_Guard & operator=(const Scope_Guard &)=delete
void release() noexcept
Release the guard without calling cleanup.
Scope_Guard(const Scope_Guard &)=delete
Copying disabled.
bool is_active() const noexcept
Check if guard is still active.
void cleanup_now()
Execute cleanup immediately and deactivate.
~Scope_Guard()
Destructor - calls cleanup function if still active.
auto get_arc_it() const noexcept
Obtains an iterator to the arc of graph.
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
constexpr size_t get_num_arcs() const noexcept
auto get_node_it() const noexcept
Obtains an iterator to the nodes of graph.
#define ARC_COOKIE(p)
Return the arc cookie
auto with_clean_cookies(GT &g, Func &&func) -> decltype(func())
Convenience function to run an algorithm with automatic cookie cleanup.
auto with_saved_cookies(GT &g, Func &&func) -> decltype(func())
Convenience function to run an algorithm preserving existing cookies.
#define NODE_COOKIE(p)
Return the node cookie
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Generic graph and digraph implementations.