Skip to content

Commit 5d55001

Browse files
JohelEGPtkoeppe
authored andcommitted
[string.view.template] Wrap synopsis in its namespace (#4038)
1 parent c0dc327 commit 5d55001

File tree

1 file changed

+114
-112
lines changed

1 file changed

+114
-112
lines changed

source/strings.tex

Lines changed: 114 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -4032,119 +4032,121 @@
40324032
\indexlibrarymember{size_type}{basic_string_view}%
40334033
\indexlibrarymember{difference_type}{basic_string_view}%
40344034
\begin{codeblock}
4035-
template<class charT, class traits = char_traits<charT>>
4036-
class basic_string_view {
4037-
public:
4038-
// types
4039-
using traits_type = traits;
4040-
using value_type = charT;
4041-
using pointer = value_type*;
4042-
using const_pointer = const value_type*;
4043-
using reference = value_type&;
4044-
using const_reference = const value_type&;
4045-
using const_iterator = @\impdefx{type of \tcode{basic_string_view::const_iterator}}@; // see \ref{string.view.iterators}
4046-
using iterator = const_iterator;@\footnote{Because \tcode{basic_string_view} refers to a constant sequence, \tcode{iterator} and \tcode{const_iterator} are the same type.}@
4047-
using const_reverse_iterator = reverse_iterator<const_iterator>;
4048-
using reverse_iterator = const_reverse_iterator;
4049-
using size_type = size_t;
4050-
using difference_type = ptrdiff_t;
4051-
static constexpr size_type npos = size_type(-1);
4052-
4053-
// \ref{string.view.cons}, construction and assignment
4054-
constexpr basic_string_view() noexcept;
4055-
constexpr basic_string_view(const basic_string_view&) noexcept = default;
4056-
constexpr basic_string_view& operator=(const basic_string_view&) noexcept = default;
4057-
constexpr basic_string_view(const charT* str);
4058-
constexpr basic_string_view(const charT* str, size_type len);
4035+
namespace std {
4036+
template<class charT, class traits = char_traits<charT>>
4037+
class basic_string_view {
4038+
public:
4039+
// types
4040+
using traits_type = traits;
4041+
using value_type = charT;
4042+
using pointer = value_type*;
4043+
using const_pointer = const value_type*;
4044+
using reference = value_type&;
4045+
using const_reference = const value_type&;
4046+
using const_iterator = @\impdefx{type of \tcode{basic_string_view::const_iterator}}@; // see \ref{string.view.iterators}
4047+
using iterator = const_iterator;@\footnote{Because \tcode{basic_string_view} refers to a constant sequence, \tcode{iterator} and \tcode{const_iterator} are the same type.}@
4048+
using const_reverse_iterator = reverse_iterator<const_iterator>;
4049+
using reverse_iterator = const_reverse_iterator;
4050+
using size_type = size_t;
4051+
using difference_type = ptrdiff_t;
4052+
static constexpr size_type npos = size_type(-1);
4053+
4054+
// \ref{string.view.cons}, construction and assignment
4055+
constexpr basic_string_view() noexcept;
4056+
constexpr basic_string_view(const basic_string_view&) noexcept = default;
4057+
constexpr basic_string_view& operator=(const basic_string_view&) noexcept = default;
4058+
constexpr basic_string_view(const charT* str);
4059+
constexpr basic_string_view(const charT* str, size_type len);
4060+
template<class It, class End>
4061+
constexpr basic_string_view(It begin, End end);
4062+
4063+
// \ref{string.view.iterators}, iterator support
4064+
constexpr const_iterator begin() const noexcept;
4065+
constexpr const_iterator end() const noexcept;
4066+
constexpr const_iterator cbegin() const noexcept;
4067+
constexpr const_iterator cend() const noexcept;
4068+
constexpr const_reverse_iterator rbegin() const noexcept;
4069+
constexpr const_reverse_iterator rend() const noexcept;
4070+
constexpr const_reverse_iterator crbegin() const noexcept;
4071+
constexpr const_reverse_iterator crend() const noexcept;
4072+
4073+
// \ref{string.view.capacity}, capacity
4074+
constexpr size_type size() const noexcept;
4075+
constexpr size_type length() const noexcept;
4076+
constexpr size_type max_size() const noexcept;
4077+
[[nodiscard]] constexpr bool empty() const noexcept;
4078+
4079+
// \ref{string.view.access}, element access
4080+
constexpr const_reference operator[](size_type pos) const;
4081+
constexpr const_reference at(size_type pos) const;
4082+
constexpr const_reference front() const;
4083+
constexpr const_reference back() const;
4084+
constexpr const_pointer data() const noexcept;
4085+
4086+
// \ref{string.view.modifiers}, modifiers
4087+
constexpr void remove_prefix(size_type n);
4088+
constexpr void remove_suffix(size_type n);
4089+
constexpr void swap(basic_string_view& s) noexcept;
4090+
4091+
// \ref{string.view.ops}, string operations
4092+
constexpr size_type copy(charT* s, size_type n, size_type pos = 0) const;
4093+
4094+
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
4095+
4096+
constexpr int compare(basic_string_view s) const noexcept;
4097+
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
4098+
constexpr int compare(size_type pos1, size_type n1, basic_string_view s,
4099+
size_type pos2, size_type n2) const;
4100+
constexpr int compare(const charT* s) const;
4101+
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
4102+
constexpr int compare(size_type pos1, size_type n1, const charT* s, size_type n2) const;
4103+
4104+
constexpr bool starts_with(basic_string_view x) const noexcept;
4105+
constexpr bool starts_with(charT x) const noexcept;
4106+
constexpr bool starts_with(const charT* x) const;
4107+
constexpr bool ends_with(basic_string_view x) const noexcept;
4108+
constexpr bool ends_with(charT x) const noexcept;
4109+
constexpr bool ends_with(const charT* x) const;
4110+
4111+
// \ref{string.view.find}, searching
4112+
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
4113+
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
4114+
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
4115+
constexpr size_type find(const charT* s, size_type pos = 0) const;
4116+
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
4117+
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
4118+
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
4119+
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
4120+
4121+
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
4122+
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
4123+
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
4124+
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
4125+
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
4126+
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
4127+
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
4128+
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
4129+
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
4130+
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
4131+
constexpr size_type find_first_not_of(const charT* s, size_type pos,
4132+
size_type n) const;
4133+
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
4134+
constexpr size_type find_last_not_of(basic_string_view s,
4135+
size_type pos = npos) const noexcept;
4136+
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
4137+
constexpr size_type find_last_not_of(const charT* s, size_type pos,
4138+
size_type n) const;
4139+
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
4140+
4141+
private:
4142+
const_pointer data_; // \expos
4143+
size_type size_; // \expos
4144+
};
4145+
4146+
// \ref{string.view.deduct}, deduction guide
40594147
template<class It, class End>
4060-
constexpr basic_string_view(It begin, End end);
4061-
4062-
// \ref{string.view.iterators}, iterator support
4063-
constexpr const_iterator begin() const noexcept;
4064-
constexpr const_iterator end() const noexcept;
4065-
constexpr const_iterator cbegin() const noexcept;
4066-
constexpr const_iterator cend() const noexcept;
4067-
constexpr const_reverse_iterator rbegin() const noexcept;
4068-
constexpr const_reverse_iterator rend() const noexcept;
4069-
constexpr const_reverse_iterator crbegin() const noexcept;
4070-
constexpr const_reverse_iterator crend() const noexcept;
4071-
4072-
// \ref{string.view.capacity}, capacity
4073-
constexpr size_type size() const noexcept;
4074-
constexpr size_type length() const noexcept;
4075-
constexpr size_type max_size() const noexcept;
4076-
[[nodiscard]] constexpr bool empty() const noexcept;
4077-
4078-
// \ref{string.view.access}, element access
4079-
constexpr const_reference operator[](size_type pos) const;
4080-
constexpr const_reference at(size_type pos) const;
4081-
constexpr const_reference front() const;
4082-
constexpr const_reference back() const;
4083-
constexpr const_pointer data() const noexcept;
4084-
4085-
// \ref{string.view.modifiers}, modifiers
4086-
constexpr void remove_prefix(size_type n);
4087-
constexpr void remove_suffix(size_type n);
4088-
constexpr void swap(basic_string_view& s) noexcept;
4089-
4090-
// \ref{string.view.ops}, string operations
4091-
constexpr size_type copy(charT* s, size_type n, size_type pos = 0) const;
4092-
4093-
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
4094-
4095-
constexpr int compare(basic_string_view s) const noexcept;
4096-
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
4097-
constexpr int compare(size_type pos1, size_type n1, basic_string_view s,
4098-
size_type pos2, size_type n2) const;
4099-
constexpr int compare(const charT* s) const;
4100-
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
4101-
constexpr int compare(size_type pos1, size_type n1, const charT* s, size_type n2) const;
4102-
4103-
constexpr bool starts_with(basic_string_view x) const noexcept;
4104-
constexpr bool starts_with(charT x) const noexcept;
4105-
constexpr bool starts_with(const charT* x) const;
4106-
constexpr bool ends_with(basic_string_view x) const noexcept;
4107-
constexpr bool ends_with(charT x) const noexcept;
4108-
constexpr bool ends_with(const charT* x) const;
4109-
4110-
// \ref{string.view.find}, searching
4111-
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
4112-
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
4113-
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
4114-
constexpr size_type find(const charT* s, size_type pos = 0) const;
4115-
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
4116-
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
4117-
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
4118-
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
4119-
4120-
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
4121-
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
4122-
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
4123-
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
4124-
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
4125-
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
4126-
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
4127-
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
4128-
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
4129-
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
4130-
constexpr size_type find_first_not_of(const charT* s, size_type pos,
4131-
size_type n) const;
4132-
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
4133-
constexpr size_type find_last_not_of(basic_string_view s,
4134-
size_type pos = npos) const noexcept;
4135-
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
4136-
constexpr size_type find_last_not_of(const charT* s, size_type pos,
4137-
size_type n) const;
4138-
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
4139-
4140-
private:
4141-
const_pointer data_; // \expos
4142-
size_type size_; // \expos
4143-
};
4144-
4145-
// \ref{string.view.deduct}, deduction guide
4146-
template<class It, class End>
4147-
basic_string_view(It, End) -> basic_string_view<iter_value_t<It>>;
4148+
basic_string_view(It, End) -> basic_string_view<iter_value_t<It>>;
4149+
}
41484150
\end{codeblock}
41494151

41504152
\pnum

0 commit comments

Comments
 (0)