cnorxz/src/include/array/aindex.h

61 lines
1.1 KiB
C
Raw Normal View History

2022-09-17 22:08:01 +02:00
#ifndef __cxz_aindex_h__
#define __cxz_aindex_h__
#include "ranges/range_base.h"
#include "ranges/index_base.h"
#include "ranges/xindex.h"
#include "ranges/yrange.h"
namespace CNORXZ
{
// AIndex (A = Array)
2022-09-17 22:08:01 +02:00
template <typename T>
class AIndex : public YIndex
2022-09-17 22:08:01 +02:00
{
public:
typedef YIndex::IB IB;
using YIndex::operator=;
2022-09-17 22:08:01 +02:00
DEFAULT_MEMBERS(AIndex);
AIndex(const T* data, const RangePtr& range, SizeT lexpos = 0);
AIndex(const T* data, const YIndex& yindex);
2022-09-17 22:08:01 +02:00
AIndex operator+(Int n) const;
AIndex operator-(Int n) const;
2022-09-17 22:08:01 +02:00
const T& operator*() const;
const T* operator->() const;
protected:
const T* mCData = nullptr;
};
// BIndex (because B comes after A...)
template <typename T>
class BIndex : public AIndex<T>
{
public:
typedef AIndex<T> AI;
typedef typename AI::IB IB;
DEFAULT_MEMBERS(BIndex);
BIndex(T* data, const RangePtr& range, SizeT pos = 0);
BIndex(T* data, const AIndex<T>& cci);
2022-09-17 22:08:01 +02:00
BIndex operator+(Int n) const;
BIndex operator-(Int n) const;
T& operator*();
T* operator->();
private:
T* mData = nullptr;
};
}
#endif