34 #include <itpp/itexports.h>
40 template<
class T>
class Array;
41 template<
class Num_T>
class Mat;
42 template<
class Num_T>
class Vec;
143 template<
class T>
inline
146 void *p =
operator new(
sizeof(T) * n);
147 ptr =
reinterpret_cast<T*
>(p);
148 for (
int i = 0; i < n; i++) {
159 void *p =
operator new(
sizeof(
unsigned char) * n);
160 ptr =
reinterpret_cast<unsigned char*
>(p);
167 void *p =
operator new(
sizeof(
bin) * n);
168 ptr =
reinterpret_cast<bin*
>(p);
175 void *p =
operator new(
sizeof(
short int) * n);
176 ptr =
reinterpret_cast<short int*
>(p);
183 void *p =
operator new(
sizeof(int) * n);
184 ptr =
reinterpret_cast<int*
>(p);
191 void *p0 =
operator new(
sizeof(double) * n + 16);
192 void *p1 =
reinterpret_cast<void*
>((
reinterpret_cast<std::size_t
>(p0) + 16)
193 & (~(std::size_t(15))));
194 *(
reinterpret_cast<void**
>(p1) - 1) = p0;
195 ptr =
reinterpret_cast<double*
>(p1);
200 void create_elements<std::complex<double> >(std::complex<double>* &ptr,
203 void *p0 =
operator new(
sizeof(std::complex<double>) * n + 16);
204 void *p1 =
reinterpret_cast<void*
>((
reinterpret_cast<std::size_t
>(p0) + 16)
205 & (~(std::size_t(15))));
206 *(
reinterpret_cast<void**
>(p1) - 1) = p0;
207 ptr =
reinterpret_cast<std::complex<double>*
>(p1);
213 template<
class T>
inline
217 for (
int i = 0; i < n; ++i) {
220 void *p =
reinterpret_cast<void*
>(ptr);
231 void *p =
reinterpret_cast<void*
>(ptr);
242 void *p =
reinterpret_cast<void*
>(ptr);
252 void *p =
reinterpret_cast<void*
>(ptr);
263 void *p =
reinterpret_cast<void*
>(ptr);
274 void *p = *(
reinterpret_cast<void**
>(ptr) - 1);
282 void destroy_elements<std::complex<double> >(std::complex<double>* &ptr, int)
285 void *p = *(
reinterpret_cast<void**
>(ptr) - 1);
296 void *p =
operator new(
sizeof(
Array<T>) * n);
297 ptr =
reinterpret_cast<Array<T>*
>(p);
298 for (
int i = 0; i < n; ++i) {
307 void *p =
operator new(
sizeof(
Mat<T>) * n);
308 ptr =
reinterpret_cast<Mat<T>*
>(p);
309 for (
int i = 0; i < n; ++i) {
318 void *p =
operator new(
sizeof(
Vec<T>) * n);
319 ptr =
reinterpret_cast<Vec<T>*
>(p);
320 for (
int i = 0; i < n; ++i) {
327 #endif // #ifndef FACTORY_H