Skip to content

Commit c64a070

Browse files
committed
Add lifetime annotations to buffer types
1 parent 7e6b9c2 commit c64a070

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/cpp-sort/utility/buffer.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <array>
1212
#include <cstddef>
1313
#include <memory>
14+
#include "../detail/config.h"
1415

1516
namespace cppsort::utility
1617
{
@@ -39,48 +40,56 @@ namespace cppsort::utility
3940
}
4041

4142
constexpr auto operator[](std::size_t pos)
43+
CPPSORT_LIFETIME_BOUND
4244
-> typename std::array<T, N>::reference
4345
{
4446
return _memory[pos];
4547
}
4648

4749
constexpr auto operator[](std::size_t pos) const
50+
CPPSORT_LIFETIME_BOUND
4851
-> typename std::array<T, N>::const_reference
4952
{
5053
return _memory[pos];
5154
}
5255

5356
constexpr auto begin()
57+
CPPSORT_LIFETIME_BOUND
5458
-> T*
5559
{
5660
return _memory.data();
5761
}
5862

5963
constexpr auto begin() const
64+
CPPSORT_LIFETIME_BOUND
6065
-> const T*
6166
{
6267
return _memory.data();
6368
}
6469

6570
constexpr auto cbegin() const
71+
CPPSORT_LIFETIME_BOUND
6672
-> const T*
6773
{
6874
return _memory.data();
6975
}
7076

7177
constexpr auto end()
78+
CPPSORT_LIFETIME_BOUND
7279
-> T*
7380
{
7481
return _memory.data() + _memory.size();
7582
}
7683

7784
constexpr auto end() const
85+
CPPSORT_LIFETIME_BOUND
7886
-> const T*
7987
{
8088
return _memory.data() + _memory.size();
8189
}
8290

8391
constexpr auto cend() const
92+
CPPSORT_LIFETIME_BOUND
8493
-> const T*
8594
{
8695
return _memory.data() + _memory.size();
@@ -193,48 +202,56 @@ namespace cppsort::utility
193202
}
194203

195204
auto operator[](std::size_t pos)
205+
CPPSORT_LIFETIME_BOUND
196206
-> T&
197207
{
198208
return _memory[pos];
199209
}
200210

201211
auto operator[](std::size_t pos) const
212+
CPPSORT_LIFETIME_BOUND
202213
-> const T&
203214
{
204215
return _memory[pos];
205216
}
206217

207218
auto begin()
219+
CPPSORT_LIFETIME_BOUND
208220
-> T*
209221
{
210222
return _memory.get();
211223
}
212224

213225
auto begin() const
226+
CPPSORT_LIFETIME_BOUND
214227
-> const T*
215228
{
216229
return _memory.get();
217230
}
218231

219232
auto cbegin() const
233+
CPPSORT_LIFETIME_BOUND
220234
-> const T*
221235
{
222236
return _memory.get();
223237
}
224238

225239
auto end()
240+
CPPSORT_LIFETIME_BOUND
226241
-> T*
227242
{
228243
return _memory.get() + size();
229244
}
230245

231246
auto end() const
247+
CPPSORT_LIFETIME_BOUND
232248
-> const T*
233249
{
234250
return _memory.get() + size();
235251
}
236252

237253
auto cend() const
254+
CPPSORT_LIFETIME_BOUND
238255
-> const T*
239256
{
240257
return _memory.get() + size();

0 commit comments

Comments
 (0)