aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.com>2024-08-08 00:09:06 +0300
committerswarmer <swarmer@yandex-team.com>2024-08-08 00:20:28 +0300
commit7155674ad6031a1f17aaea06cbd8f203873dfd9c (patch)
tree16b42d7fef9b2fb4544a20c6a95f1e68c55289c8 /util
parent4ae47fbf6a3efacf151874204c61a815134a5146 (diff)
downloadydb-7155674ad6031a1f17aaea06cbd8f203873dfd9c.tar.gz
check the lifetime bound of the TArrayRef
9124a77116ef1ec2f8c14a3684fea08b4253601c
Diffstat (limited to 'util')
-rw-r--r--util/generic/array_ref.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h
index 83d225c6ff..2f8005449a 100644
--- a/util/generic/array_ref.h
+++ b/util/generic/array_ref.h
@@ -41,19 +41,19 @@ public:
{
}
- constexpr inline TArrayRef(T* data, size_t len) noexcept
+ constexpr inline TArrayRef(T* data Y_LIFETIME_BOUND, size_t len) noexcept
: T_(data)
, S_(len)
{
}
- constexpr inline TArrayRef(T* begin, T* end) noexcept
+ constexpr inline TArrayRef(T* begin Y_LIFETIME_BOUND, T* end Y_LIFETIME_BOUND) noexcept
: T_(begin)
, S_(end - begin)
{
}
- constexpr inline TArrayRef(std::initializer_list<T> list) noexcept
+ constexpr inline TArrayRef(std::initializer_list<T> list Y_LIFETIME_BOUND) noexcept
: T_(list.begin())
, S_(list.size())
{
@@ -70,7 +70,7 @@ public:
}
template <size_t N>
- constexpr inline TArrayRef(T (&array)[N]) noexcept
+ constexpr inline TArrayRef(T (&array)[N] Y_LIFETIME_BOUND) noexcept
: T_(array)
, S_(N)
{
@@ -234,7 +234,7 @@ private:
* Named as its std counterparts, std::as_bytes.
*/
template <typename T>
-TArrayRef<const char> as_bytes(TArrayRef<T> arrayRef) noexcept {
+TArrayRef<const char> as_bytes(TArrayRef<T> arrayRef Y_LIFETIME_BOUND) noexcept {
return TArrayRef<const char>(
reinterpret_cast<const char*>(arrayRef.data()),
arrayRef.size_bytes());
@@ -246,7 +246,7 @@ TArrayRef<const char> as_bytes(TArrayRef<T> arrayRef) noexcept {
* Named as its std counterparts, std::as_writable_bytes.
*/
template <typename T>
-TArrayRef<char> as_writable_bytes(TArrayRef<T> arrayRef) noexcept {
+TArrayRef<char> as_writable_bytes(TArrayRef<T> arrayRef Y_LIFETIME_BOUND) noexcept {
return TArrayRef<char>(
reinterpret_cast<char*>(arrayRef.data()),
arrayRef.size_bytes());
@@ -273,11 +273,11 @@ constexpr TArrayRef<const typename Range::value_type> MakeConstArrayRef(Range& r
}
template <class T>
-constexpr TArrayRef<T> MakeArrayRef(T* data, size_t size) {
+constexpr TArrayRef<T> MakeArrayRef(T* data Y_LIFETIME_BOUND, size_t size) {
return TArrayRef<T>(data, size);
}
template <class T>
-constexpr TArrayRef<T> MakeArrayRef(T* begin, T* end) {
+constexpr TArrayRef<T> MakeArrayRef(T* begin Y_LIFETIME_BOUND, T* end Y_LIFETIME_BOUND) {
return TArrayRef<T>(begin, end);
}