Browse Source

DEV: deque (and derived classes) have some extra noexcpets

master
parent
commit
d2f8165ec6
4 changed files with 24 additions and 24 deletions
  1. +4
    -4
      include/cont/deque.h
  2. +10
    -10
      include/cont/edeque.h
  3. +5
    -5
      include/cont/equeue.h
  4. +5
    -5
      include/cont/queue.h

+ 4
- 4
include/cont/deque.h View File

@@ -164,7 +164,7 @@ class deque {
} }
//! \brief Push an item in the front of the deque //! \brief Push an item in the front of the deque
//! \param it The item to push //! \param it The item to push
constexpr void push_front (const Data_t& it) {
constexpr void push_front (const Data_t& it) noexcept {
if (full()) return; if (full()) return;
if constexpr (SemiAtomic) if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);
@@ -174,7 +174,7 @@ class deque {
} }
//! \brief Extract an item from the front of the deque and remove it from the deque //! \brief Extract an item from the front of the deque and remove it from the deque
//! \param it The item to push //! \param it The item to push
constexpr Data_t pop_front () {
constexpr Data_t pop_front () noexcept {
if (empty()) return Data_t{}; if (empty()) return Data_t{};
if constexpr (SemiAtomic) if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);
@@ -182,7 +182,7 @@ class deque {
} }
//! \brief Push an item in the back of the deque //! \brief Push an item in the back of the deque
//! \param it The item to push //! \param it The item to push
constexpr void push_back (const Data_t& it) {
constexpr void push_back (const Data_t& it) noexcept {
if (full()) return; if (full()) return;
if constexpr (SemiAtomic) if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);
@@ -192,7 +192,7 @@ class deque {
} }
//! \brief Extract an item from the back of the deque and remove it from the deque //! \brief Extract an item from the back of the deque and remove it from the deque
//! \param it The item to push //! \param it The item to push
constexpr Data_t pop_back () {
constexpr Data_t pop_back () noexcept {
if (empty()) return Data_t{}; if (empty()) return Data_t{};
if constexpr (SemiAtomic) if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire); std::atomic_thread_fence(std::memory_order_acquire);


+ 10
- 10
include/cont/edeque.h View File

@@ -130,7 +130,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
base_type() { } base_type() { }
//! Size trigger constructor //! Size trigger constructor
constexpr edeque (size_match match, size_t size, callable_t&& fn) :
constexpr edeque (size_match match, size_t size, callable_t&& fn) noexcept :
base_type(), base_type(),
mode_{match_mode::SIZE}, mode_{match_mode::SIZE},
callback_{std::forward<callable_t>(fn)} { callback_{std::forward<callable_t>(fn)} {
@@ -138,7 +138,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
trigger_.tsize.size = size; trigger_.tsize.size = size;
} }
//! Data trigger constructor //! Data trigger constructor
constexpr edeque (data_match match, Data_t value, callable_t&& fn) :
constexpr edeque (data_match match, Data_t value, callable_t&& fn) noexcept :
base_type(), base_type(),
mode_{match_mode::DATA}, mode_{match_mode::DATA},
callback_{std::forward<callable_t>(fn)} { callback_{std::forward<callable_t>(fn)} {
@@ -153,7 +153,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
//! \brief //! \brief
//! Manually checks the size trigger and calls it we have match. //! Manually checks the size trigger and calls it we have match.
//! \return True if the callable has called. //! \return True if the callable has called.
bool check_trigger () {
bool check_trigger () noexcept {
return check_trigger_size_(); return check_trigger_size_();
} }
@@ -163,7 +163,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
//! \param match The match type //! \param match The match type
//! \param size The size for with we check against //! \param size The size for with we check against
//! \param fn The callable to call on match //! \param fn The callable to call on match
void set_trigger (size_match match, size_t size, callable_t&& fn) {
void set_trigger (size_match match, size_t size, callable_t&& fn) noexcept {
mode_ = match_mode::SIZE; mode_ = match_mode::SIZE;
trigger_.tsize.type = match; trigger_.tsize.type = match;
trigger_.tsize.size = size; trigger_.tsize.size = size;
@@ -176,7 +176,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
//! \param match The match type //! \param match The match type
//! \param value The value for with we check against //! \param value The value for with we check against
//! \param fn The callable to call on match //! \param fn The callable to call on match
void set_trigger (data_match match, Data_t value, callable_t&& fn) {
void set_trigger (data_match match, Data_t value, callable_t&& fn) noexcept {
mode_ = match_mode::DATA; mode_ = match_mode::DATA;
trigger_.tdata.type = match; trigger_.tdata.type = match;
trigger_.tdata.value= value; trigger_.tdata.value= value;
@@ -184,7 +184,7 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
} }
//! \brief Manually clears the trigger //! \brief Manually clears the trigger
void clear_trigger () {
void clear_trigger () noexcept {
mode_ = match_mode{}; mode_ = match_mode{};
trigger_ = trigger{}; trigger_ = trigger{};
callback_ = callable_t{}; callback_ = callable_t{};
@@ -193,20 +193,20 @@ class edeque : public deque<Data_t, N, SemiAtomic> {
//! \name Base class overwrites //! \name Base class overwrites
//! @{ //! @{
void push_front (const Data_t& it) {
void push_front (const Data_t& it) noexcept {
base_type::push_front(it); base_type::push_front(it);
check_trigger_push_async_(it); check_trigger_push_async_(it);
} }
Data_t pop_front () {
Data_t pop_front () noexcept {
Data_t t = base_type::pop_front(); Data_t t = base_type::pop_front();
check_trigger_pop_async_(t); check_trigger_pop_async_(t);
return t; return t;
} }
void push_back (const Data_t& it) {
void push_back (const Data_t& it) noexcept {
base_type::push_back(it); base_type::push_back(it);
check_trigger_push_async_(it); check_trigger_push_async_(it);
} }
Data_t pop_back () {
Data_t pop_back () noexcept {
Data_t t = base_type::pop_back(); Data_t t = base_type::pop_back();
check_trigger_pop_async_(t); check_trigger_pop_async_(t);
return t; return t;


+ 5
- 5
include/cont/equeue.h View File

@@ -92,26 +92,26 @@ class equeue : public edeque<Data_t, N, SemiAtomic, Fn> {
public: public:
//! \brief Push an item in the back of the queue //! \brief Push an item in the back of the queue
//! \param it The item to push //! \param it The item to push
void push (const Data_t& it) {
void push (const Data_t& it) noexcept {
base_type::push_back(it); base_type::push_back(it);
} }
//! \brief Extract an item from the front of the queue and remove it from the queue //! \brief Extract an item from the front of the queue and remove it from the queue
//! \param it The item to push //! \param it The item to push
Data_t pop () {
Data_t pop () noexcept {
return base_type::pop_front(); return base_type::pop_front();
} }
//! \brief Push an item in the back of the queue //! \brief Push an item in the back of the queue
//! \param it The item to push //! \param it The item to push
equeue_t& operator<< (const Data_t& it) {
equeue_t& operator<< (const Data_t& it) noexcept {
push(it); push(it);
return *this; return *this;
} }
//! \brief Push an item in the back of the queue //! \brief Push an item in the back of the queue
//! \param it The item to push //! \param it The item to push
equeue_t& operator>> (Data_t& it) {
equeue_t& operator>> (Data_t& it) noexcept {
it = pop(); it = pop();
return *this; return *this;
} }
@@ -136,7 +136,7 @@ class equeue : public edeque<Data_t, N, SemiAtomic, Fn> {
* \return Reference to the returned item * \return Reference to the returned item
*/ */
template <typename Data_t, size_t N, bool SemiAtomic =false, typename Fn = std::function<void()>> template <typename Data_t, size_t N, bool SemiAtomic =false, typename Fn = std::function<void()>>
Data_t& operator<< (Data_t& it, equeue<Data_t, N, SemiAtomic, Fn>& q) {
Data_t& operator<< (Data_t& it, equeue<Data_t, N, SemiAtomic, Fn>& q) noexcept {
it = q.pop(); it = q.pop();
return it; return it;
} }


+ 5
- 5
include/cont/queue.h View File

@@ -93,26 +93,26 @@ class queue : public deque<Data_t, N, SemiAtomic> {
public: public:
//! \brief Push an item in the back of the queue //! \brief Push an item in the back of the queue
//! \param it The item to push //! \param it The item to push
constexpr void push (const Data_t& it) {
constexpr void push (const Data_t& it) noexcept {
base_type::push_back(it); base_type::push_back(it);
} }
//! \brief Extract an item from the front of the queue and remove it from the queue //! \brief Extract an item from the front of the queue and remove it from the queue
//! \param it The item to push //! \param it The item to push
constexpr Data_t pop () {
constexpr Data_t pop () noexcept {
return base_type::pop_front(); return base_type::pop_front();
} }
//! \brief Push an item in the back of the queue //! \brief Push an item in the back of the queue
//! \param it The item to push //! \param it The item to push
constexpr queue_t& operator<< (const Data_t& it) {
constexpr queue_t& operator<< (const Data_t& it) noexcept {
push(it); push(it);
return *this; return *this;
} }
//! \brief Pop an item from the front of the queue //! \brief Pop an item from the front of the queue
//! \param it The item to write to //! \param it The item to write to
constexpr queue_t& operator>> (Data_t& it) {
constexpr queue_t& operator>> (Data_t& it) noexcept {
it = pop(); it = pop();
return *this; return *this;
} }
@@ -134,7 +134,7 @@ class queue : public deque<Data_t, N, SemiAtomic> {
* \return Reference to the returned item * \return Reference to the returned item
*/ */
template <typename Data_t, size_t N, bool SemiAtomic =false> template <typename Data_t, size_t N, bool SemiAtomic =false>
constexpr Data_t& operator<< (Data_t& it, queue<Data_t, N, SemiAtomic>& q) {
constexpr Data_t& operator<< (Data_t& it, queue<Data_t, N, SemiAtomic>& q) noexcept {
it = q.pop(); it = q.pop();
return it; return it;
} }


Loading…
Cancel
Save