10 template<
typename _t_item>
44 template<
typename t_source>
70 template<
typename t_to,
typename t_from>
73 if (p_to.has_owned_items(p_from)) {
85 template<
typename t_array,
typename t_value>
88 for(
t_size n=0;n<size;n++) p_array[n] = p_value;
91 template<
typename _t_item,
template<
typename>
class t_alloc>
class array_t {
99 template<
typename t_source>
const t_self &
operator=(
const t_source & p_source) {
copy_array_t(*
this,p_source);
return *
this;}
106 template<
typename fill_t>
110 for(
size_t w = before; w < p_size; ++w) this->
get_ptr()[w] = filler;
114 if (minSize >= maxSize) {
set_size( minSize);
return; }
115 size_t walk = maxSize;
120 }
catch(std::bad_alloc) {
121 if (walk <= minSize)
throw;
125 if (walk < minSize) walk = minSize;
138 template<
typename t_source>
144 template<
typename t_array>
151 for(
t_size n=0;n<source_size;n++)
m_alloc[base+n] = p_source[n];
155 template<
typename t_insert>
158 if (base > oldSize) base = oldSize;
166 template<
typename t_append>
168 PFC_ASSERT( !
is_owned(&p_buffer[0]) );
176 if (new_size < p_delta)
throw std::bad_alloc();
180 template<
typename t_append>
187 template<
typename t_append>
197 template<
typename t_filler>
198 void fill(
const t_filler & p_filler) {
218 template<
typename t_array>
229 template<
typename t_source>
231 return m_alloc.is_ptr_owned(&p_item);
234 template<
typename t_item>
240 template<
typename t_callback>
void enumerate(t_callback & p_callback)
const {
for(
t_size n = 0; n <
get_size(); n++ ) { p_callback((*
this)[n]); } }
249 template<
typename t_item,t_size p_w
idth,
template<
typename>
class t_alloc =
alloc_standard >
258 template<
typename t_comparator = comparator_default>
261 template<
typename t_array1,
typename t_array2>
262 static int compare(
const t_array1 & p_array1,
const t_array2 & p_array2) {
265 if (walk >= p_array1.get_size() && walk >= p_array2.get_size())
return 0;
266 else if (walk >= p_array1.get_size())
return -1;
267 else if (walk >= p_array2.get_size())
return 1;
270 if (state != 0)
return state;
277 template<
typename t_a1,
typename t_a2>
281 for(
t_size walk = 0; walk < s; ++walk) {
282 if (arr1[walk] != arr2[walk])
return false;
315 PFC_ASSERT( i1 <
m_d1 ); PFC_ASSERT( i2 <
m_d2 );
316 return ptr + i1 *
m_d2 + i2;
325 #endif //_PFC_ARRAY_H_
void increase_size(t_size p_delta)
const t_item & at(t_size i1, t_size i2) const
void set_size_in_range(size_t minSize, size_t maxSize)
const t_item * get_ptr() const
array_staticsize_t(t_size p_size)
const t_item * get_ptr() const
array_t(const t_self &p_source)
t_alloc< t_item > m_alloc
void set_size_fill(size_t p_size, fill_t const &filler)
Special simplififed version of array class that avoids stepping on landmines with classes without pub...
const t_item * rowPtr(t_size i1) const
void append_multi(const t_append &value, t_size count)
t_type replace_null_t(t_type &p_var)
const t_item & operator[](t_size p_index) const
array_t(const t_source &p_source)
array_staticsize_t< t_item > t_self
int compare(t1 const &p1, t2 const &p2)
void fill_ptr_t(t_array *p_buffer, const t_size p_count, const t_filler &p_filler)
t_item & operator[](t_size p_index)
array_staticsize_t(const t_self &p_source)
Copy constructor nonfunctional when data type is not copyable.
t_item & operator[](t_size p_index)
void move_from(t_self &other)
void append_single(const t_append &p_item)
void append_single_val(t_append item)
const t_item * operator[](t_size i1) const
t_item & at(t_size i1, t_size i2)
array_t(t_self &&p_source)
array_t< t_item, t_alloc > t_self
void copy_array_t(t_to &p_to, const t_from &p_from)
void copy_array_loop_t(t_dst &p_dst, const t_src &p_src, t_size p_count)
void set_count(t_size p_count)
bool is_owned(const t_source &p_item)
const t_self & operator=(t_self &&p_source)
void set_size(t_size p_size)
void memmove_t(T *p_dst, const T *p_src, t_size p_count)
const t_item & operator[](t_size p_index) const
void prealloc(t_size p_size)
void fill_array_t(t_array &p_array, const t_value &p_value)
void enumerate(t_out &out) const
const t_self & operator=(const t_self &p_source)
void append_fromptr(const t_append *p_buffer, t_size p_count)
Warning: buffer pointer must not point to buffer allocated by this array (fixme). ...
pfc::array_t< t_item, t_alloc > m_content
void fill(const t_filler &p_filler)
void set_data_fromptr(const t_source *p_buffer, t_size p_count)
Warning: buffer pointer must not point to buffer allocated by this array (fixme). ...
void fill(const t_filler &p_filler)
bool has_owned_items(const t_array &p_source)
void set_size(t_size d1, t_size d2)
void fill_t(t_array &p_buffer, const t_size p_count, const t_filler &p_filler)
t_size array_size_t(const t_array &p_array)
void insert_multi(const t_insert &value, t_size base, t_size count)
t_ptr _transformPtr(t_ptr ptr, t_size i1, t_size i2) const
void append(const t_array &p_source)
t_item * rowPtr(t_size i1)
void enumerate(t_callback &p_callback) const
void set_size_discard(t_size p_size)
const t_self & operator=(const t_self &p_source)
Copy operator nonfunctional when data type is not copyable.
void set_size_discard(t_size p_size)
static bool array_equals(const t_a1 &arr1, const t_a2 &arr2)
void set_single(const t_item &p_item)
const t_self & operator=(const t_source &p_source)
t_item * operator[](t_size i1)
void grow_size(t_size p_size)
void set_data_fromptr(const t_source *p_buffer, t_size p_count)
Warning: buffer pointer must not point to buffer allocated by this array (fixme). ...
static int compare(const t_array1 &p_array1, const t_array2 &p_array2)
bool is_pointer_in_range(const t_item *p_buffer, t_size p_buffer_size, const void *p_pointer)
bool is_owned(const t_source &p_item)