bug fixed

This commit is contained in:
Christian Zimmermann 2017-02-26 14:00:47 +01:00
parent 7965ea25fe
commit d2d038fd5b
3 changed files with 6 additions and 6 deletions

View file

@ -1,3 +1,4 @@
// -*- C++ -*-
#include "multi_array_operation.h"
@ -245,7 +246,7 @@ namespace MultiArrayTools
template <typename T, class Operation, class... MAOps>
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,MAOps2...>
MultiArrayOperation<T,Operation,MAOps...>::operator()(Operation2& op, const MAOps&... secs)
MultiArrayOperation<T,Operation,MAOps...>::operator()(Operation2& op, const MAOps2&... secs)
{
return MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,
MAOps2...>(op, *this, secs...);
@ -254,7 +255,7 @@ namespace MultiArrayTools
template <typename T, class Operation, class... MAOps>
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,MAOps2...>
MultiArrayOperation<T,Operation,MAOps...>::operator()(const Operation2& op, const MAOps&... secs)
MultiArrayOperation<T,Operation,MAOps...>::operator()(const Operation2& op, const MAOps2&... secs)
{
return MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,
MAOps2...>(op, *this, secs...);
@ -301,7 +302,6 @@ namespace MultiArrayTools
template <typename T, class Operation, class... MAOps>
void MultiArrayOperation<T,Operation,MAOps...>::linkIndicesTo(IndefinitIndexBase* target) const
{
MAOB::mIibPtr->linkTo(target);
TupleIndicesLinker<sizeof...(MAOps)-1>::linkTupleIndicesTo(mArgs, target);
}

View file

@ -102,11 +102,11 @@ namespace MultiArrayTools
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,MAOps2...>
operator()(Operation2& op, const MAOps&... secs);
operator()(Operation2& op, const MAOps2&... secs);
template <class Operation2, class... MAOps2>
MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,MAOps2...>
operator()(const Operation2& op, const MAOps&... secs);
operator()(const Operation2& op, const MAOps2&... secs);
template <class MAOp2>
auto operator+(const MAOp2& sec) -> decltype(operator()(std::plus<T>(), sec));

View file

@ -297,7 +297,7 @@ namespace {
auto i3 = i.template getIndex<2>();
//ma2("alpha","beta") = ma("alpha","beta") + ma1d("alpha");
ma3d2("alpha","beta","gamma") = ma3d("alpha","beta","gamma") + ( ma("alpha","beta") + ma1d("alpha") );
ma3d2("alpha","beta","gamma") = ma3d("alpha","beta","gamma") + ma("alpha","beta") + ma1d("alpha");
EXPECT_EQ(ma3d2[i(i1 = 0, i2 = 0, i3 = 0)], -15);
EXPECT_EQ(ma3d2[i(i1 = 0, i2 = 0, i3 = 1)], -4);