Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_dfs_stack.H File Reference

Stack of the frames of a depth-first search that does not recurse. More...

#include <algorithm>
#include <concepts>
#include <cstddef>
#include <memory>
#include <new>
#include <optional>
#include <type_traits>
#include <utility>
Include dependency graph for tpl_dfs_stack.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::dfs_stack_detail::Room
 Room of a destroyed stack, kept for the next stack of the thread. More...
 
struct  Aleph::dfs_stack_detail::Room_Keeper
 Opens the room of the thread, and frees it when the thread ends, but for the thread of main() with glibc: then the process ends, which frees it, and freeing a room of 64 KiB or more would make glibc merge the small free blocks, which at the end of the process are often many. More...
 
class  Aleph::Dfs_Stack< T >
 Stack of the frames of a depth-first search that does not recurse. More...
 
struct  Aleph::Dfs_Arc_Frame< It >
 The next arc of a node to look at, for a depth-first search that keeps only that in a frame. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::dfs_stack_detail
 

Macros

#define ALEPH_FLATTEN   [[gnu::flatten]]
 [[gnu::flatten]], or nothing where it would only make the compilation slower.
 

Typedefs

template<class T >
using Aleph::Dfs_Here = std::conditional_t< std::is_move_assignable_v< T >, T, std::optional< T > >
 The variable that holds the frame of the node that a depth-first search visits.
 

Functions

void Aleph::dfs_stack_detail::poison (const void *p, size_t bytes) noexcept
 
void Aleph::dfs_stack_detail::unpoison (const void *p, size_t bytes) noexcept
 
void Aleph::dfs_stack_detail::free_room (void *r, size_t bytes) noexcept
 
Room & Aleph::dfs_stack_detail::kept_room () noexcept
 
bool Aleph::dfs_stack_detail::in_main_thread () noexcept
 
Room & Aleph::dfs_stack_detail::open_room () noexcept
 
template<class T , class... Args>
Dfs_Here< T > Aleph::dfs_here (Args &&...args)
 Builds the variable of the frame of a search, with the frame built with args.
 
template<class T >
T & Aleph::dfs_frame (T &here) noexcept
 The frame that a Dfs_Here holds.
 
template<class T >
T & Aleph::dfs_frame (std::optional< T > &here) noexcept
 The frame that a Dfs_Here holds.
 
template<class T , class... Args>
void Aleph::dfs_replace (T &here, Args &&...args)
 Replaces the frame that a Dfs_Here holds with one built with args, by assignment.
 
template<class T , class... Args>
void Aleph::dfs_replace (std::optional< T > &here, Args &&...args)
 Replaces the frame that a Dfs_Here holds with one built in its place with args.
 
template<class It >
decltype(auto) Aleph::dfs_curr (const It &it)
 The current item of an iterator that has one.
 

Variables

constexpr size_t Aleph::dfs_stack_detail::Kept_Bytes = 1024 * 1024
 
constexpr bool Aleph::dfs_stack_detail::Poisoned = false
 

Detailed Description

Stack of the frames of a depth-first search that does not recurse.

A depth-first search can go as deep as the graph has nodes, which overflows the call stack if it recurses. The searches that do not recurse keep, in a Dfs_Stack, what recursion would keep in each frame: the node being visited and the iterator over its arcs.

Author
Leandro Rabindranath León

Definition in file tpl_dfs_stack.H.