17#ifndef __min_mem_array_h__
18#define __min_mem_array_h__
57 for (
size_t a = 0; a != n; ++a)
64 d (
new T[data.size()])
67 for (
typename C::const_iterator i = data.begin(); i != data.end(); ++i, ++
index)
75 memcpy (d, that.d, n * sizeof (T));
84 void add (
const T& i) {
86 T* new_data =
new T[n + 1];
87 memcpy (new_data, d, n *
sizeof (T));
100 void add_copyconstruct (
const T& i) {
102 T* new_data =
new T[n + 1];
103 for (
size_t a = 0; a != n; ++a)
128 void load (C& data)
const {
129 for (
size_t i = 0; i != n; ++i)
130 data.push_back (d[i]);
133 size_t dim()
const {
return n; }
136 return ((n == that.n) && !memcmp (d, that.d, n * sizeof (T)));
145 for (
size_t i = 0; i != std::min (n, that.n); ++i) {
146 if (d[i] < that.d[i])
148 if (d[i] > that.d[i])
157 T& operator[] (
const size_t i) {
162 const T& operator[] (
const size_t i)
const {
172 memcpy (d, that.d, n * sizeof (T));