17 template <
typename T,
int S>
class FArray {
52 template <
typename T2>
FArray(
const T2 t[S]) {
53 for (
int i=0;i<S;i++) (*
this)[i] = T(t[i]);
64 for (
int i=0;i<S;i++) (*
this)[i] = T(a[i]);
75 (*this)[0]=v0; (*this)[1]=v1;
87 (*this)[0]=v0; (*this)[1]=v1; (*this)[2]=v2;
100 (*this)[0]=v0; (*this)[1]=v1; (*this)[2]=v2; (*this)[3]=v3;
122 for (
int i=0;i<S;i++) (*
this)[i] = T(t[i]);
134 for (
int i=0;i<S;i++) (*
this)[i] = T(b[i]);
152 bool empty()
const {
return false; }
216 iterator
end() {
return _data+S; }
223 const_iterator
end()
const {
return _data+S; }
242 return !(*
this == b);
253 std::pair<T,T> r(a[0],a[0]);
254 for (const_iterator it = a.
begin()+1 ; it != a.
end() ; ++it)
256 r.first = std::min(r.first, *it);
257 r.second = std::max(r.second, *it);
270 out.write((
const char*)a.
_data,(std::streamsize)S*
sizeof(T));
281 in.read((
char*)a.
_data,(std::streamsize)S*
sizeof(T));
293 for (const_iterator it = a.
begin() ; it != a.
end() ; ++it)
307 for (iterator it = a.
begin() ; it != a.
end() ; ++it)
const_iterator begin() const
Begin const iterator.
Definition: FArray.h:209
T * data()
Data pointer (write).
Definition: FArray.h:195
FArray(const T2 t[S])
Constructor from C array.
Definition: FArray.h:52
T _data[S]
internal storage.
Definition: FArray.h:21
iterator begin()
Begin iterator.
Definition: FArray.h:202
friend void write(std::ostream &out, const FArray &a)
Binary write.
Definition: FArray.h:269
friend std::istream & operator>>(std::istream &in, FArray &a)
ASCII read.
Definition: FArray.h:306
const T & operator[](int i) const
Read access.
Definition: FArray.h:167
bool operator!=(const FArray &b) const
Inequality test.
Definition: FArray.h:241
const T * const_iterator
Const iterator type.
Definition: FArray.h:27
bool empty() const
Is empty.
Definition: FArray.h:152
const_iterator end() const
End const iterator.
Definition: FArray.h:223
FArray()
Empty constructor.
Definition: FArray.h:34
friend std::ostream & operator<<(std::ostream &out, const FArray &a)
ASCII write.
Definition: FArray.h:292
FArray(T v0, T v1)
2D alias.
Definition: FArray.h:73
iterator end()
End iterator.
Definition: FArray.h:216
FArray & operator=(const FArray< T2, S > &b)
Assignment.
Definition: FArray.h:146
Array of fixed size.
Definition: FArray.h:17
FArray(const T &v)
Constructor with constant value.
Definition: FArray.h:41
int size() const
Size.
Definition: FArray.h:159
T * iterator
Iterator type.
Definition: FArray.h:25
bool operator==(const FArray &b) const
Equality test.
Definition: FArray.h:231
Imagine++ namespace.
Definition: Array.h:7
FArray(T v0, T v1, T v2, T v3)
4D alias.
Definition: FArray.h:98
const T * data() const
Data pointer (read).
Definition: FArray.h:188
FArray(const FArray< T2, S > &a)
Copy constructor.
Definition: FArray.h:63
FArray & fill(const T &v)
Filling.
Definition: FArray.h:109
FArray(T v0, T v1, T v2)
3D alias.
Definition: FArray.h:85
FArray & copy(const FArray< T2, S > &b)
Copy.
Definition: FArray.h:133
FArray & copy(const T2 t[S])
C array of different type copy.
Definition: FArray.h:121
friend void read(std::istream &in, FArray &a)
Binary read.
Definition: FArray.h:280
friend std::pair< T, T > range(const FArray &a)
Range.
Definition: FArray.h:251