DiffMessage: implement convenience ctor to build from Lumiera Iterator
This commit is contained in:
parent
9e4f3f3314
commit
7dc0fdd67a
3 changed files with 21 additions and 11 deletions
|
|
@ -51,6 +51,7 @@
|
|||
#include "lib/iter-source.hpp"
|
||||
#include "lib/diff/tree-diff.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
#include "lib/meta/util.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -59,6 +60,11 @@ namespace lib {
|
|||
namespace diff{
|
||||
|
||||
using std::string;
|
||||
using std::__and_;
|
||||
using std::__not_;
|
||||
using lib::meta::enable_if;
|
||||
using lib::meta::can_IterForEach;
|
||||
using lib::meta::can_STL_ForEach;
|
||||
|
||||
using DiffStep = TreeDiffLanguage::DiffStep;
|
||||
using DiffSource = IterSource<DiffStep>;
|
||||
|
|
@ -86,6 +92,9 @@ namespace diff{
|
|||
struct DiffMessage
|
||||
: DiffSource::iterator
|
||||
{
|
||||
using _FrontEnd = DiffSource::iterator;
|
||||
|
||||
|
||||
DiffMessage() = default;
|
||||
|
||||
/**
|
||||
|
|
@ -95,7 +104,12 @@ namespace diff{
|
|||
*/
|
||||
explicit
|
||||
DiffMessage(DiffSource* diffGenerationContext)
|
||||
: DiffSource::iterator{DiffSource::build (diffGenerationContext)}
|
||||
: _FrontEnd{DiffSource::build (diffGenerationContext)}
|
||||
{ }
|
||||
|
||||
template<class IT>
|
||||
DiffMessage(IT ii, enable_if< can_IterForEach<IT>, void*> =nullptr)
|
||||
: _FrontEnd{iter_source::wrapIter(ii)}
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -249,13 +249,9 @@ namespace lib {
|
|||
protected:
|
||||
using ConRef = typename iter::TypeBinding<CON>::reference;
|
||||
|
||||
/** allow derived classes to
|
||||
* access backing container */
|
||||
ConRef
|
||||
source()
|
||||
{
|
||||
return source_;
|
||||
}
|
||||
/** allow derived classes to access backing container */
|
||||
ConRef source() { return source_; }
|
||||
const ConRef source() const { return unConst(this)->source_; }
|
||||
|
||||
private:
|
||||
void
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ namespace iter {
|
|||
template<typename TY>
|
||||
struct TypeBinding<std::shared_ptr<TY>>
|
||||
{
|
||||
typedef TY value_type;
|
||||
typedef const TY& reference;
|
||||
typedef const TY* pointer;
|
||||
typedef std::shared_ptr<TY> value_type;
|
||||
typedef std::shared_ptr<TY>& reference;
|
||||
typedef std::shared_ptr<TY>* pointer;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue