mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
make detail::make_checked() constexpr
This commit is contained in:
parent
04b4b69b11
commit
5888de9f34
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user