typecast
parent
73094dbd6d
commit
bf6d15015a
|
@ -109,6 +109,15 @@ namespace blt::mem
|
||||||
return prev_size * 2;
|
return prev_size * 2;
|
||||||
return prev_size + default_allocation_block;
|
return prev_size + default_allocation_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename R, typename T>
|
||||||
|
inline static R type_cast(T type)
|
||||||
|
{
|
||||||
|
static_assert(sizeof(T) == sizeof(R));
|
||||||
|
R r;
|
||||||
|
std::memcpy(&r, &type, sizeof(type));
|
||||||
|
return r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //BLT_MEMORY_UTIL_H
|
#endif //BLT_MEMORY_UTIL_H
|
||||||
|
|
Loading…
Reference in New Issue