From 0fc836ce8f80493591a217ebee34a2db52620e67 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 18 Jan 2019 16:24:26 +0300 Subject: [PATCH] Make td::as safe. GitOrigin-RevId: 84a76a434f88e09d9c74644aee139a96bb34239d --- tdutils/td/utils/as.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tdutils/td/utils/as.h b/tdutils/td/utils/as.h index e3fc8a24d..815e777d3 100644 --- a/tdutils/td/utils/as.h +++ b/tdutils/td/utils/as.h @@ -7,6 +7,7 @@ #pragma once #include +#include namespace td { @@ -60,12 +61,14 @@ class ConstAs { } // namespace detail -template +template ::value && std::is_trivially_copyable::value, int> = 0> detail::As as(FromT *from) { return detail::As(from); } -template +template ::value && std::is_trivially_copyable::value, int> = 0> const detail::ConstAs as(const FromT *from) { return detail::ConstAs(from); }