Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit f1f199d

Browse files
authored
Merge pull request #1181 from KFilipek/master
[string_view] add description for methods in string_view
2 parents e8f5621 + 9fa5ca8 commit f1f199d

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

include/libpmemobj++/string_view.hpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,18 @@ class basic_string_view {
6868
constexpr basic_string_view(const std::basic_string<CharT, Traits> &s);
6969
constexpr basic_string_view(const CharT *data);
7070

71+
/** Constructor initialized with the basic_string_view *rhs*.
72+
*
73+
* @param[in] rhs basic_string_view to initialize with
74+
*/
7175
constexpr basic_string_view(const basic_string_view &rhs) noexcept =
7276
default;
77+
78+
/**
79+
* Replaces the view with that of *rhs*.
80+
*
81+
* @param[in] rhs basic_string_view to replace with
82+
*/
7383
basic_string_view &
7484
operator=(const basic_string_view &rhs) noexcept = default;
7585

@@ -166,7 +176,7 @@ constexpr inline basic_string_view<CharT, Traits>::basic_string_view() noexcept
166176
}
167177

168178
/**
169-
* Constructor initialized by *data* and its *size*.
179+
* Constructor initialized with *data* and its *size*.
170180
*
171181
* @param[in] data pointer to the C-like string to initialize with,
172182
* it can contain null characters.
@@ -257,27 +267,59 @@ basic_string_view<CharT, Traits>::cend() const noexcept
257267
return data_ + size_;
258268
}
259269

270+
/**
271+
* Returns a reverse_iterator to the character following the last character of
272+
* the view (reverse beginning). Reverse iterators iterate backwards: increasing
273+
* them moves them towards the beginning of the string.
274+
*
275+
* @return const_reverse_iterator to the character following the last character.
276+
*/
260277
template <typename CharT, typename Traits>
261278
constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator
262279
basic_string_view<CharT, Traits>::rbegin() const noexcept
263280
{
264281
return reverse_iterator(cend());
265282
}
266283

284+
/**
285+
* Returns a reverse_iterator to the character following the last character of
286+
* the view (reverse beginning). Reverse iterators iterate backwards: increasing
287+
* them moves them towards the beginning of the string.
288+
*
289+
* @return const_reverse_iterator to the character following the last character.
290+
*/
267291
template <typename CharT, typename Traits>
268292
constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator
269293
basic_string_view<CharT, Traits>::crbegin() const noexcept
270294
{
271295
return reverse_iterator(cend());
272296
}
273297

298+
/**
299+
* Returns an iterator to the first character of the view.
300+
* Reverse iterators iterate backwards: increasing
301+
* them moves them towards the beginning of the string.
302+
* This character acts as a placeholder, attempting to access it results
303+
* in undefined behavior.
304+
*
305+
* @return const_reverse_iterator to the first character
306+
*/
274307
template <typename CharT, typename Traits>
275308
constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator
276309
basic_string_view<CharT, Traits>::rend() const noexcept
277310
{
278311
return reverse_iterator(cbegin());
279312
}
280313

314+
/**
315+
* Returns an iterator to the first character of the view.
316+
* Reverse iterators iterate backwards: increasing
317+
* them moves them towards the beginning of the string.
318+
* This character acts as a placeholder, attempting to access it results
319+
* in undefined behavior.
320+
*
321+
* @return const_reverse_iterator to the first character
322+
*/
281323
template <typename CharT, typename Traits>
282324
constexpr typename basic_string_view<CharT, Traits>::const_reverse_iterator
283325
basic_string_view<CharT, Traits>::crend() const noexcept
@@ -445,7 +487,7 @@ basic_string_view<CharT, Traits>::swap(
445487
std::swap(size_, v.size_);
446488
}
447489

448-
/*
490+
/**
449491
* Finds the first substring equal to str.
450492
*
451493
* @param[in] str string to search for

0 commit comments

Comments
 (0)