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
This commit is contained in:
Fischlurch 2017-08-05 17:57:25 +02:00
parent 3dea3c0fa0
commit 56def9f6d7
2 changed files with 32 additions and 16 deletions

View file

@ -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

View file

@ -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();
}
};