akildemir
2025-03-12 15:34:51 +03:00
parent 378ec75a6e
commit 1cf81058b6
15 changed files with 49 additions and 49 deletions
+2 -2
View File
@@ -172,8 +172,8 @@ namespace crypto {
*/
template<typename T>
T rand() {
static_assert(std::is_standard_layout_v<T>, "cannot write random bytes into non-standard layout type");
static_assert(std::is_trivially_copyable_v<T>, "cannot write random bytes into non-trivially copyable type");
static_assert(std::is_standard_layout<T>(), "cannot write random bytes into non-standard layout type");
static_assert(std::is_trivially_copyable<T>(), "cannot write random bytes into non-trivially copyable type");
typename std::remove_cv<T>::type res;
generate_random_bytes_thread_safe(sizeof(T), (uint8_t*)&res);
return res;