ソースを参照

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

master
コミット
d2f8165ec6
4個のファイルの変更24行の追加24行の削除
  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 ファイルの表示

@@ -164,7 +164,7 @@ class deque {
}
//! \brief Push an item in the front of the deque
//! \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 constexpr (SemiAtomic)
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
//! \param it The item to push
constexpr Data_t pop_front () {
constexpr Data_t pop_front () noexcept {
if (empty()) return Data_t{};
if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire);
@@ -182,7 +182,7 @@ class deque {
}
//! \brief Push an item in the back of the deque
//! \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 constexpr (SemiAtomic)
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
//! \param it The item to push
constexpr Data_t pop_back () {
constexpr Data_t pop_back () noexcept {
if (empty()) return Data_t{};
if constexpr (SemiAtomic)
std::atomic_thread_fence(std::memory_order_acquire);


+ 10
- 10
include/cont/edeque.h ファイルの表示

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


+ 5
- 5
include/cont/equeue.h ファイルの表示

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


+ 5
- 5
include/cont/queue.h ファイルの表示

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


読み込み中…
キャンセル
保存