Library/IterSource: allow for mix-in extension of the IterSource interface

...at least when using a wrapped Lumiera Iterator as source.
Generally speaking, this is a tricky problem, since real mix-in interfaces
would require the base interface (IterSource) to be declared virtual.

Which incurres a performance penalty on each and every user of IterSource,
even without any mix-in additions. The tricky part with this is to quantify
the relevance of such a performance penalty, since IterSource is meant
to be a generic library facility and is a fundamental building block
on several component interfaces within the architecture.
This commit is contained in:
Fischlurch 2017-12-23 18:55:26 +01:00
parent 64ba7bf372
commit f05b3f56c0
2 changed files with 6 additions and 7 deletions

View file

@ -229,13 +229,12 @@ namespace lib {
* is passed to one of the IterSource's builder functions, thereby
* erasing the specific type information of the template parameter IT
*/
template<class IT>
template<class IT, class ISO = IterSource<typename IT::value_type>>
class WrappedLumieraIter
: public IterSource<typename IT::value_type>
: public ISO
, boost::noncopyable
{
using _Base = IterSource<typename IT::value_type>;
using Pos = typename _Base::Pos;
using Pos = typename ISO::Pos;
IT src_;

View file

@ -856,15 +856,15 @@ namespace test{
verify_IterSource()
{
class PrivateSource
// : public IterSource<uint> /////////////////////////////////////TODO linearised Mix-in problem
: public IterSource<uint>
{
public:
virtual PrivateSource* expandChildren() const =0;
};
class VerySpecivicIter
: public WrappedLumieraIter<NumberSequence>
, public PrivateSource
: public WrappedLumieraIter<NumberSequence
, PrivateSource >
{
public:
VerySpecivicIter(uint start)