From 56def9f6d79a261f695c2f8d7249af65684fee68 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 5 Aug 2017 17:57:25 +0200 Subject: [PATCH] Library: expose some diagnostics on IterStack / IterQueue by default seems like most usages will want to expose this kind of diagnostics for unit testing and in fact the queue or stack nature is the primary nature of this entity, while iterability comes as additional trait --- src/lib/iter-stack.hpp | 33 +++++++++++++++++++++++++++++- src/proc/control/command-queue.hpp | 15 -------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/lib/iter-stack.hpp b/src/lib/iter-stack.hpp index 681233d45..16b9511f5 100644 --- a/src/lib/iter-stack.hpp +++ b/src/lib/iter-stack.hpp @@ -67,8 +67,9 @@ namespace lib { + using util::unConst; + namespace iter { - using util::unConst; /** * Wrapper to mark a std::deque instance for use @@ -153,6 +154,21 @@ namespace lib { this->stateCore().pop_back(); return topElement; } + + + /* == diagnostics == */ + + size_t + size() const + { + return unConst(this)->stateCore().size(); + } + + bool + empty() const + { + return 0 == size(); + } }; @@ -208,6 +224,21 @@ namespace lib { } + /* == diagnostics == */ + + size_t + size() const + { + return unConst(this)->stateCore().size(); + } + + bool + empty() const + { + return 0 == size(); + } + + /** * Adapter for use as opaque sequence. * This builder exposes generic operations diff --git a/src/proc/control/command-queue.hpp b/src/proc/control/command-queue.hpp index cc82b1c69..a5b54ec3a 100644 --- a/src/proc/control/command-queue.hpp +++ b/src/proc/control/command-queue.hpp @@ -87,21 +87,6 @@ namespace control { { this->stateCore().clear(); } - - - /* == diagnostics == */ - - size_t - size() const - { - return unConst(this)->stateCore().size(); - } - - bool - empty() const - { - return 0 == size(); - } };