36#if HAVE_LIBTHREADAR_LIBTHREADAR_HPP
37#include <libthreadar/libthreadar.hpp>
48 template <
class T>
class heap
54 heap & operator = (
const heap & ref) =
delete;
55 heap & operator = (
heap && ref)
noexcept =
default;
57 std::unique_ptr<T> get();
58 void put(std::unique_ptr<T> && obj);
59 void put(std::deque<std::unique_ptr<T> > & list);
60 U_I get_size()
const {
return tas.size(); };
63 std::deque<std::unique_ptr<T> > tas;
64#ifdef LIBTHREADAR_AVAILABLE
65 libthreadar::mutex access;
71 std::unique_ptr<T> ret;
73#ifdef LIBTHREADAR_AVAILABLE
80 throw Erange(
"heap::get",
"heap is empty, it should have be set larger");
82 ret = std::move(tas.back());
85#ifdef LIBTHREADAR_AVAILABLE
98 template <
class T>
void heap<T>::put(std::unique_ptr<T> && obj)
100#ifdef LIBTHREADAR_AVAILABLE
106 tas.push_back(std::move(obj));
108#ifdef LIBTHREADAR_AVAILABLE
119 template <
class T>
void heap<T>::put(std::deque<std::unique_ptr<T> > & list)
121 typename std::deque<std::unique_ptr<T> >::iterator it = list.begin();
123#ifdef LIBTHREADAR_AVAILABLE
129 while(it != list.end())
131 tas.push_back(std::move(*it));
135#ifdef LIBTHREADAR_AVAILABLE
exception used to signal range error
the class heap is nothing related to the common heap datastructure this is just a "heap" in the sense...
are defined here basic integer types that tend to be portable
include macro defined by the configure script and some specific additional ones
libdar namespace encapsulate all libdar symbols