diff --git a/src/block.cc b/src/block.cc index a351545..8ad4f19 100644 --- a/src/block.cc +++ b/src/block.cc @@ -32,6 +32,7 @@ namespace MultiArrayHelper static OpFunc f; if(mRes.size() == 0) { mRes.assign(arg.size(), static_cast(0)); } assert(mRes.size() == arg.size()); + VCHECK(arg); for(size_t i = 0; i != arg.size(); ++i){ mRes[i] = f(mRes[i], arg[i]); } diff --git a/src/block.h b/src/block.h index ffb6610..e007350 100644 --- a/src/block.h +++ b/src/block.h @@ -56,7 +56,7 @@ namespace MultiArrayHelper }; template - std::ostream& operator<<(std::ostream& out, const BlockBase& block) + std::ostream& operator<<(std::ostream& out, const MBlock& block) { out << block[0]; for(size_t i = 1; i != block.size(); ++i){ @@ -64,6 +64,17 @@ namespace MultiArrayHelper } return out; } + + template + std::ostream& operator<<(std::ostream& out, const BlockResult& block) + { + out << block[0]; + for(size_t i = 1; i != block.size(); ++i){ + out << ", " << block[i]; + } + return out; + } + template class MutableBlockBase : public BlockBase diff --git a/src/multi_array_operation.cc b/src/multi_array_operation.cc index 647e882..54bee2c 100644 --- a/src/multi_array_operation.cc +++ b/src/multi_array_operation.cc @@ -355,8 +355,9 @@ namespace MultiArrayTools template const BlockResult& Contraction::get() const { - BlockBinaryOpSelf,BlockResult > f(mRes); + BlockBinaryOpSelf,decltype(mOp.get())> f(mRes); for(*mInd = 0; mInd->pos() != mInd->max(); ++(*mInd)){ + VCHECK(mInd->pos()); f(mOp.get()); } return mRes;