fix compile errors -> seg fault :)

This commit is contained in:
Christian Zimmermann 2017-02-20 19:14:22 +01:00
parent 00c6cf49d5
commit 68612646fb
3 changed files with 12 additions and 12 deletions

View file

@ -30,7 +30,7 @@ namespace MultiArrayTools
virtual size_t dim() const = 0;
virtual size_t pos() const; // = mPos; implement !!!
virtual const std::string& name() const;
virtual void name(const std::string& str);
virtual void name(const Name& nm);

View file

@ -57,8 +57,8 @@ namespace MultiArrayTools
template <class MultiIndex>
static size_t evaluate(const MultiIndex& index)
{
//const auto& subIndex = index.getIndex<N>();
return Evaluation<N-1>::evaluate(index) * index.getIndex<N>().size() + index.getIndex<N>().pos();
const IndefinitIndexBase& subIndex = IndexGetter<N>::getIndex(index, N);
return Evaluation<N-1>::evaluate(index) * subIndex.max() + subIndex.pos();
}
};
@ -68,8 +68,8 @@ namespace MultiArrayTools
template <class MultiIndex>
static size_t evaluate(const MultiIndex& index)
{
//const auto& subIndex = index.getIndex<0>();
return index.getIndex<0>().pos();
const IndefinitIndexBase& subIndex = IndexGetter<0>::getIndex(index, 0);
return subIndex.pos();
}
};
@ -156,7 +156,7 @@ namespace MultiArrayTools
IndefinitIndexBase& MultiIndex<Indices...>::operator=(size_t pos)
{
IIB::setPos( pos );
setIndexPack(mIPack, pos); // -> implement !!!
//setIndexPack(mIPack, pos); // -> implement !!!
return *this;
}
@ -207,11 +207,11 @@ namespace MultiArrayTools
template <class... Indices>
bool MultiIndex<Indices...>::link(IndefinitIndexBase* toLink)
{
if(toLink->rangeType() != IIB::rangeType() and toLink->name() == IIB::name()){
if(toLink->rangeType() != rangeType() and toLink->name() == IIB::name()){
// throw !!
}
if(toLink->rangeType() == IIB::rangeType() and toLink->name() == IIB::name()){
if(toLink->rangeType() == rangeType() and toLink->name() == IIB::name()){
if(IIB::mLinked == toLink){
return true; // dont link twice the same
}
@ -230,7 +230,7 @@ namespace MultiArrayTools
template <class... Indices>
template <size_t N>
auto MultiIndex<Indices...>::getIndex() -> decltype(std::get<N>(mIPack))&
auto MultiIndex<Indices...>::getIndex() -> decltype(std::get<N>(mIPack))
{
return std::get<N>(mIPack);
}
@ -238,7 +238,7 @@ namespace MultiArrayTools
template <class... Indices>
template <size_t N>
auto MultiIndex<Indices...>::getIndex() const ->
const decltype(std::get<N>(mIPack))&
const decltype(std::get<N>(mIPack))
{
return std::get<N>(mIPack);
}

View file

@ -44,10 +44,10 @@ namespace MultiArrayTools
virtual MultiRangeType rangeType() const override;
template <size_t N>
auto getIndex() -> decltype(std::get<N>(mIPack))&;
auto getIndex() -> decltype(std::get<N>(mIPack));
template <size_t N>
auto getIndex() const -> const decltype(std::get<N>(mIPack))&;
auto getIndex() const -> const decltype(std::get<N>(mIPack));
IndefinitIndexBase& get(size_t n);
const IndefinitIndexBase& get(size_t n) const;