2022-11-16 11:28:39 +01:00
|
|
|
|
// ======= Copyright nillerusr, 2022 =======
|
|
|
|
|
|
|
|
|
|
// Helper аunctions for setting/сopying memory ( specially for non-POD types )
|
|
|
|
|
// FUCK STL
|
|
|
|
|
|
|
|
|
|
#ifndef MEMHELPERS_H
|
|
|
|
|
#define MEMHELPERS_H
|
|
|
|
|
|
|
|
|
|
namespace memutils
|
|
|
|
|
{
|
|
|
|
|
template<typename T>
|
|
|
|
|
inline void copy( T *dest, const T *src, size_t n )
|
|
|
|
|
{
|
2023-01-14 12:48:22 +01:00
|
|
|
|
for(; n; n--)
|
|
|
|
|
*(dest++) = *(src++);
|
2022-11-16 11:28:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
2023-01-14 12:48:22 +01:00
|
|
|
|
inline void set( T *dest, const T& value, size_t n )
|
2022-11-16 11:28:39 +01:00
|
|
|
|
{
|
2023-01-14 12:48:22 +01:00
|
|
|
|
for(; n; n--)
|
|
|
|
|
*(dest++) = value;
|
2022-11-16 11:28:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif //MEMHELPERS_H
|