minor changes

This commit is contained in:
Christian Zimmermann 2020-09-09 10:12:20 +02:00
parent 59e4f4ecfd
commit e3afa8b8c1
2 changed files with 42 additions and 30 deletions

View file

@ -59,12 +59,12 @@ namespace MultiArrayTools
}
template <class ROP>
auto HighLevelOpRoot<ROP>::create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2)
-> typename B::template RetT<CI,CI>
template <class... Inds>
auto HighLevelOpRoot<ROP>::xcreate(const std::shared_ptr<Inds>&... inds)
-> typename B::template RetT<Inds...>
{
assert(0);
return typename B::template RetT<CI,CI>();
return typename B::template RetT<Inds...>();
}
template <class ROP>
@ -160,15 +160,19 @@ namespace MultiArrayTools
template <class ROP, class OpF, size_t N>
const ROP* HighLevelOp<ROP,OpF,N>::get() const
{ assert(0); return nullptr; }
{
assert(0);
return nullptr;
}
template <class ROP, class OpF, size_t N>
auto HighLevelOp<ROP,OpF,N>::create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2)
-> typename B::template RetT<CI,CI>
template <class... Inds>
auto HighLevelOp<ROP,OpF,N>::xcreate(const std::shared_ptr<Inds>&... inds)
-> typename B::template RetT<Inds...>
{
typename B::template RetT<CI,CI> res;
Create<N-1>::template cx<CI,CI>::template ccx<ROP,OpF>::template cccx<N>(res,mIn,ind1,ind2);
typename B::template RetT<Inds...> res;
Create<N-1>::template cx<Inds...>::template ccx<ROP,OpF>::template cccx<N>
(res,mIn,inds...);
return res;
}
@ -182,11 +186,11 @@ namespace MultiArrayTools
}
template <class ROP>
auto HighLevelOpHolder<ROP>::create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2) const
-> decltype(mOp->create(ind1,ind2))
template <class... Inds>
auto HighLevelOpHolder<ROP>::create(const std::shared_ptr<Inds>&... inds) const
-> decltype(mOp->create(inds...))
{
return mOp->create(ind1,ind2);
return mOp->create(inds...);
}
template <class ROP>

View file

@ -38,8 +38,8 @@ namespace MultiArrayTools
virtual bool root() const = 0;
virtual RetT<CI,CI> create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2) = 0;
virtual RetT<CI,CI> create(const std::shared_ptr<CI>& ind1,
const std::shared_ptr<CI>& ind2) = 0;
virtual const ROP* get() const = 0;
@ -51,6 +51,9 @@ namespace MultiArrayTools
private:
typedef HighLevelOpBase<ROP> B;
template <class... Inds>
typename B::template RetT<Inds...> xcreate(const std::shared_ptr<Inds>&... inds);
ROP mOp;
public:
@ -59,8 +62,8 @@ namespace MultiArrayTools
virtual bool root() const override final;
virtual typename B::template RetT<CI,CI>
create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2) override final;
create(const std::shared_ptr<CI>& ind1,
const std::shared_ptr<CI>& ind2) override final { return xcreate(ind1,ind2); }
virtual const ROP* get() const override final;
@ -78,12 +81,17 @@ namespace MultiArrayTools
template <class ROP, class OpF, size_t N>
class HighLevelOp : public HighLevelOpBase<ROP>
{
private:
std::array<std::shared_ptr<HighLevelOpBase<ROP>>,N> mIn;
public:
typedef HighLevelOpBase<ROP> B;
private:
std::array<std::shared_ptr<HighLevelOpBase<ROP>>,N> mIn;
template <class... Inds>
auto xcreate(const std::shared_ptr<Inds>&... inds)
-> typename B::template RetT<Inds...>;
public:
HighLevelOp(std::array<std::shared_ptr<HighLevelOpBase<ROP>>,N> in);
virtual bool root() const override final;
@ -91,8 +99,8 @@ namespace MultiArrayTools
virtual const ROP* get() const override final;
virtual typename B::template RetT<CI,CI>
create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2) override final;
create(const std::shared_ptr<CI>& ind1,
const std::shared_ptr<CI>& ind2) override final { return xcreate(ind1,ind2); }
};
@ -114,9 +122,9 @@ namespace MultiArrayTools
bool root() const;
auto create(const std::shared_ptr<CI> ind1,
const std::shared_ptr<CI> ind2) const
-> decltype(mOp->create(ind1,ind2));
template <class... Inds>
auto create(const std::shared_ptr<Inds>&... inds) const
-> decltype(mOp->create(inds...));
auto get() const -> decltype(mOp->get());