make detail::make_checked() constexpr

This commit is contained in:
Alexey Ochapov 2021-08-27 00:55:21 +03:00 committed by Victor Zverovich
parent 04b4b69b11
commit 5888de9f34

View File

@ -339,12 +339,15 @@ inline auto get_data(Container& c) -> typename Container::value_type* {
#if defined(_SECURE_SCL) && _SECURE_SCL #if defined(_SECURE_SCL) && _SECURE_SCL
// Make a checked iterator to avoid MSVC warnings. // Make a checked iterator to avoid MSVC warnings.
template <typename T> using checked_ptr = stdext::checked_array_iterator<T*>; template <typename T> using checked_ptr = stdext::checked_array_iterator<T*>;
template <typename T> auto make_checked(T* p, size_t size) -> checked_ptr<T> { template <typename T>
constexpr auto make_checked(T* p, size_t size) -> checked_ptr<T> {
return {p, size}; return {p, size};
} }
#else #else
template <typename T> using checked_ptr = T*; template <typename T> using checked_ptr = T*;
template <typename T> inline auto make_checked(T* p, size_t) -> T* { return p; } template <typename T> constexpr auto make_checked(T* p, size_t) -> T* {
return p;
}
#endif #endif
// Attempts to reserve space for n extra characters in the output range. // Attempts to reserve space for n extra characters in the output range.