You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
506 B
33 lines
506 B
2 years ago
|
// ======= 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 )
|
||
|
{
|
||
|
do
|
||
|
{
|
||
|
--n;
|
||
|
*(dest+n) = *(src+n);
|
||
|
} while( n );
|
||
|
}
|
||
|
|
||
|
template<typename T>
|
||
|
inline void set( T *dest, T value, size_t n )
|
||
|
{
|
||
|
do
|
||
|
{
|
||
|
--n;
|
||
|
*(dest+n) = value;
|
||
|
} while( n );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif //MEMHELPERS_H
|