From b7945ae972f4a09b650c8ac7b18083847e0a1f9b Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Tue, 17 Jan 2023 10:22:19 +0100 Subject: [PATCH] replaced vector.insert with std::copy to avoid issues with g++ 12 (#3625) --- Source/ablastr/utils/Serialization.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ablastr/utils/Serialization.H b/Source/ablastr/utils/Serialization.H index 87f1e94d185..7fb10c14fde 100644 --- a/Source/ablastr/utils/Serialization.H +++ b/Source/ablastr/utils/Serialization.H @@ -35,7 +35,7 @@ namespace ablastr::utils::serialization const auto length = static_cast(val.size()); put_in(length, vec); - vec.insert(vec.end(), c_str, c_str + length); + std::copy(c_str, c_str + length, std::back_inserter(vec)); } else { @@ -43,7 +43,7 @@ namespace ablastr::utils::serialization "Cannot serialize non-trivally copyable types, except std::string."); const auto *ptr_val = reinterpret_cast(&val); - vec.insert(vec.end(), ptr_val, ptr_val + sizeof(T)); + std::copy(ptr_val, ptr_val + sizeof(T), std::back_inserter(vec)); } }