File include/jlib/darray.h changed (mode: 100644) (index 337c47c..8750784) |
... |
... |
namespace jl |
82 |
82 |
* @tparam P_FOO Type of pointer to function or to member function. |
* @tparam P_FOO Type of pointer to function or to member function. |
83 |
83 |
* @tparam Args Parameters pack template, should not be specified in template instantiation |
* @tparam Args Parameters pack template, should not be specified in template instantiation |
84 |
84 |
* @param[in] pfoo Pointer to function with first argument must be |
* @param[in] pfoo Pointer to function with first argument must be |
85 |
|
* copy or refference of item (T*) or pointer to member function. |
|
|
85 |
|
* copy or refference of item (T) or pointer to member function. |
86 |
86 |
* @param[in,out] args Pack of arguments to pass to pfoo function. |
* @param[in,out] args Pack of arguments to pass to pfoo function. |
87 |
87 |
*/ |
*/ |
88 |
88 |
template<typename P_FOO, typename ... Args> |
template<typename P_FOO, typename ... Args> |
|
... |
... |
namespace jl |
106 |
106 |
deallocate(&p_begin_allocated); |
deallocate(&p_begin_allocated); |
107 |
107 |
init(); |
init(); |
108 |
108 |
} |
} |
|
109 |
|
|
109 |
110 |
/** |
/** |
110 |
|
* @brief Call function for all items and deallocate memory. |
|
111 |
|
* |
|
112 |
|
* All items in the array will be unavailable after. |
|
113 |
|
* |
|
114 |
|
* @tparam P_FOO Type of pointer to function or to member function. |
|
115 |
|
* @tparam Args Parameters pack template, should not be specified in template instantiation |
|
116 |
|
* @param[in] pfoo Pointer to function with first argument must be pointer to item (T*) |
|
117 |
|
* or pointer to member function. |
|
118 |
|
* @param[in,out] args Pack of arguments to pass to pfoo function. |
|
|
111 |
|
* @brief Clean and destroy. |
119 |
112 |
* |
* |
120 |
|
* @see darray::clean |
|
|
113 |
|
* @see darray::clean(P_FOO pfoo, Args ... args) |
121 |
114 |
* @see darray::destroy |
* @see darray::destroy |
122 |
115 |
*/ |
*/ |
123 |
116 |
template<typename P_FOO, typename ... Args> |
template<typename P_FOO, typename ... Args> |
File include/jlib/rarray.h changed (mode: 100644) (index e30eccd..2eaebbc) |
7 |
7 |
|
|
8 |
8 |
#include "routines.h" |
#include "routines.h" |
9 |
9 |
#include "allocate.h" |
#include "allocate.h" |
10 |
|
#include <cinttypes> |
|
11 |
10 |
#include "assert.h" |
#include "assert.h" |
12 |
|
|
|
|
11 |
|
#include "staff/item_call.h" |
13 |
12 |
#include <type_traits> |
#include <type_traits> |
|
13 |
|
#include <cinttypes> |
14 |
14 |
|
|
15 |
15 |
namespace jl |
namespace jl |
16 |
16 |
{ |
{ |
|
... |
... |
namespace jl |
114 |
114 |
* @brief Deallocate space, set item count to 0. |
* @brief Deallocate space, set item count to 0. |
115 |
115 |
* |
* |
116 |
116 |
* Function reduce used elements count to 0, by deallocating memory. |
* Function reduce used elements count to 0, by deallocating memory. |
117 |
|
* Array items will be unaccessible after, so they must be cleaned up before this function. |
|
|
117 |
|
* Array items will be unaccessible after, |
|
118 |
|
* so they must be cleaned up before this function. |
118 |
119 |
*/ |
*/ |
119 |
120 |
void destroy() |
void destroy() |
120 |
121 |
{ |
{ |
|
... |
... |
namespace jl |
122 |
123 |
init(); |
init(); |
123 |
124 |
} |
} |
124 |
125 |
|
|
|
126 |
|
/** |
|
127 |
|
* @brief Call function for all items and destroy array. |
|
128 |
|
* |
|
129 |
|
* All items in the array will be unavailable after. |
|
130 |
|
* |
|
131 |
|
* @tparam P_FOO Type of pointer to function or member function. |
|
132 |
|
* @tparam Args Parameters pack template, should not be |
|
133 |
|
* specified in template instantiation |
|
134 |
|
* @param[in] pfoo Pointer to function with first argument, |
|
135 |
|
* copy or refference of item (T) |
|
136 |
|
* or pointer to member function. |
|
137 |
|
* @param[in,out] args Pack of arguments to pass to pfoo function. |
|
138 |
|
* |
|
139 |
|
* @see rarray::destroy |
|
140 |
|
*/ |
|
141 |
|
template<typename P_FOO, typename ... Args> |
|
142 |
|
void destroy(P_FOO pfoo, Args ... args) { |
|
143 |
|
for (auto &item : *this) |
|
144 |
|
details::item_call::call(item, pfoo, args...); |
|
145 |
|
destroy(); |
|
146 |
|
} |
|
147 |
|
|
125 |
148 |
/** |
/** |
126 |
149 |
* @brief Reallocate space, set item count to specified value. |
* @brief Reallocate space, set item count to specified value. |
127 |
150 |
* |
* |