Skip to content

Commit d04689c

Browse files
committed
[template.bitset.general][vector.bool.pspc] Break out reference nested classes into own subclauses
1 parent 1d9fdb0 commit d04689c

File tree

2 files changed

+98
-84
lines changed

2 files changed

+98
-84
lines changed

source/containers.tex

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10489,21 +10489,8 @@
1048910489
using reverse_iterator = std::reverse_iterator<iterator>;
1049010490
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
1049110491

10492-
// bit reference
10493-
class @\libmember{reference}{vector<bool>}@ {
10494-
public:
10495-
constexpr reference(const reference& x) noexcept;
10496-
constexpr ~reference();
10497-
constexpr reference& operator=(bool x) noexcept;
10498-
constexpr reference& operator=(const reference& x) noexcept;
10499-
constexpr const reference& operator=(bool x) const noexcept;
10500-
constexpr operator bool() const noexcept;
10501-
constexpr void flip() noexcept; // flips the bit
10502-
10503-
friend constexpr void swap(reference x, reference y) noexcept;
10504-
friend constexpr void swap(reference x, bool& y) noexcept;
10505-
friend constexpr void swap(bool& x, reference y) noexcept;
10506-
};
10492+
// \ref{vector.bool.reference}, bit reference
10493+
class reference;
1050710494

1050810495
// construct/copy/destroy
1050910496
constexpr vector() noexcept(noexcept(Allocator())) : vector(Allocator()) { }
@@ -10607,13 +10594,34 @@
1060710594
of \tcode{bool} values. A space-optimized representation of bits is
1060810595
recommended instead.
1060910596

10597+
\rSec3[vector.bool.reference]{Class \tcode{vector<bool>::reference}}%
1061010598
\pnum
1061110599
\tcode{reference}
1061210600
is a class that simulates a reference to a single bit in the sequence.
1061310601

10602+
\indexlibrarymember{reference}{vector<bool>}%
10603+
\begin{codeblock}
10604+
namespace std {
10605+
template<size_t N> class vector<bool>::reference {
10606+
public:
10607+
constexpr reference(const reference& x) noexcept;
10608+
constexpr ~reference();
10609+
constexpr reference& operator=(bool x) noexcept;
10610+
constexpr reference& operator=(const reference& x) noexcept;
10611+
constexpr const reference& operator=(bool x) const noexcept;
10612+
constexpr operator bool() const noexcept;
10613+
constexpr void flip() noexcept; // flips the bit
10614+
10615+
friend constexpr void swap(reference x, reference y) noexcept;
10616+
friend constexpr void swap(reference x, bool& y) noexcept;
10617+
friend constexpr void swap(bool& x, reference y) noexcept;
10618+
};
10619+
}
10620+
\end{codeblock}
10621+
1061410622
\indexlibraryctor{vector<bool>::reference}%
1061510623
\begin{itemdecl}
10616-
constexpr reference::reference(const reference& x) noexcept;
10624+
constexpr reference(const reference& x) noexcept;
1061710625
\end{itemdecl}
1061810626

1061910627
\begin{itemdescr}
@@ -10624,7 +10632,7 @@
1062410632

1062510633
\indexlibrarydtor{vector<bool>::reference}%
1062610634
\begin{itemdecl}
10627-
constexpr reference::~reference();
10635+
constexpr ~reference();
1062810636
\end{itemdecl}
1062910637

1063010638
\begin{itemdescr}
@@ -10635,9 +10643,9 @@
1063510643

1063610644
\indexlibrarymember{operator=}{vector<bool>::reference}%
1063710645
\begin{itemdecl}
10638-
constexpr reference& reference::operator=(bool x) noexcept;
10639-
constexpr reference& reference::operator=(const reference& x) noexcept;
10640-
constexpr const reference& reference::operator=(bool x) const noexcept;
10646+
constexpr reference& operator=(bool x) noexcept;
10647+
constexpr reference& operator=(const reference& x) noexcept;
10648+
constexpr const reference& operator=(bool x) const noexcept;
1064110649
\end{itemdecl}
1064210650

1064310651
\begin{itemdescr}
@@ -10653,7 +10661,7 @@
1065310661

1065410662
\indexlibrarymember{flip}{vector<bool>::reference}%
1065510663
\begin{itemdecl}
10656-
constexpr void reference::flip() noexcept;
10664+
constexpr void flip() noexcept;
1065710665
\end{itemdecl}
1065810666

1065910667
\begin{itemdescr}
@@ -10681,7 +10689,7 @@
1068110689
\end{codeblock}
1068210690
\end{itemdescr}
1068310691

10684-
10692+
\rSec3[vector.bool.members]{\tcode{vector<bool>} members}
1068510693

1068610694
\indexlibrarymember{flip}{vector<bool>}%
1068710695
\begin{itemdecl}

source/utilities.tex

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -10533,22 +10533,8 @@
1053310533
namespace std {
1053410534
template<size_t N> class bitset {
1053510535
public:
10536-
// bit reference
10537-
class reference {
10538-
public:
10539-
constexpr reference(const reference& x) noexcept;
10540-
constexpr ~reference();
10541-
constexpr reference& operator=(bool x) noexcept; // for \tcode{b[i] = x;}
10542-
constexpr reference& operator=(const reference& x) noexcept; // for \tcode{b[i] = b[j];}
10543-
constexpr const reference& operator=(bool x) const noexcept;
10544-
constexpr operator bool() const noexcept; // for \tcode{x = b[i];}
10545-
constexpr bool operator~() const noexcept; // flips the bit
10546-
constexpr reference& flip() noexcept; // for \tcode{b[i].flip();}
10547-
10548-
friend constexpr void swap(reference x, reference y) noexcept;
10549-
friend constexpr void swap(reference x, bool& y) noexcept;
10550-
friend constexpr void swap(bool& x, reference y) noexcept;
10551-
};
10536+
// \ref{bitset.reference}, bit reference
10537+
class reference;
1055210538

1055310539
// \ref{bitset.cons}, constructors
1055410540
constexpr bitset() noexcept;
@@ -10625,6 +10611,8 @@
1062510611
\tcode{bitset<N>}
1062610612
describes an object that can store a sequence consisting of a fixed number of
1062710613
bits, \tcode{N}.
10614+
The class \tcode{bitset<N>::reference} simulates a reference
10615+
to a single bit in the sequence.
1062810616

1062910617
\pnum
1063010618
Each bit represents either the value zero (reset) or one (set).
@@ -10644,12 +10632,54 @@
1064410632
or more bits is the sum of their bit values.
1064510633

1064610634
\pnum
10647-
\tcode{reference}
10648-
is a class that simulates a reference to a single bit in the sequence.
10635+
The functions described in \ref{template.bitset} can report three kinds of
10636+
errors, each associated with a distinct exception:
10637+
\begin{itemize}
10638+
\item
10639+
an
10640+
\term{invalid-argument}
10641+
error is associated with exceptions of type
10642+
\tcode{invalid_argument}\iref{invalid.argument};
10643+
\indexlibraryglobal{invalid_argument}%
10644+
\item
10645+
an
10646+
\term{out-of-range}
10647+
error is associated with exceptions of type
10648+
\tcode{out_of_range}\iref{out.of.range};
10649+
\indexlibraryglobal{out_of_range}%
10650+
\item
10651+
an
10652+
\term{overflow}
10653+
error is associated with exceptions of type
10654+
\tcode{overflow_error}\iref{overflow.error}.
10655+
\indexlibraryglobal{overflow_error}%
10656+
\end{itemize}
10657+
10658+
\rSec3[bitset.reference]{Class \tcode{bitset<N>::reference}}%
10659+
\indexlibrarymember{reference}{bitset}%
10660+
\begin{codeblock}
10661+
namespace std {
10662+
template<size_t N> class bitset<N>::reference {
10663+
public:
10664+
constexpr reference(const reference& x) noexcept;
10665+
constexpr ~reference();
10666+
constexpr reference& operator=(bool x) noexcept; // for \tcode{b[i] = x;}
10667+
constexpr reference& operator=(const reference& x) noexcept; // for \tcode{b[i] = b[j];}
10668+
constexpr const reference& operator=(bool x) const noexcept;
10669+
constexpr operator bool() const noexcept; // for \tcode{x = b[i];}
10670+
constexpr bool operator~() const noexcept; // flips the bit
10671+
constexpr reference& flip() noexcept; // for \tcode{b[i].flip();}
10672+
10673+
friend constexpr void swap(reference x, reference y) noexcept;
10674+
friend constexpr void swap(reference x, bool& y) noexcept;
10675+
friend constexpr void swap(bool& x, reference y) noexcept;
10676+
};
10677+
}
10678+
\end{codeblock}
1064910679

1065010680
\indexlibraryctor{bitset::reference}%
1065110681
\begin{itemdecl}
10652-
constexpr reference::reference(const reference& x) noexcept;
10682+
constexpr reference(const reference& x) noexcept;
1065310683
\end{itemdecl}
1065410684

1065510685
\begin{itemdescr}
@@ -10660,7 +10690,7 @@
1066010690

1066110691
\indexlibrarydtor{bitset::reference}%
1066210692
\begin{itemdecl}
10663-
constexpr reference::~reference();
10693+
constexpr ~reference();
1066410694
\end{itemdecl}
1066510695

1066610696
\begin{itemdescr}
@@ -10671,9 +10701,9 @@
1067110701

1067210702
\indexlibrarymember{operator=}{bitset::reference}%
1067310703
\begin{itemdecl}
10674-
constexpr reference& reference::operator=(bool x) noexcept;
10675-
constexpr reference& reference::operator=(const reference& x) noexcept;
10676-
constexpr const reference& reference::operator=(bool x) const noexcept;
10704+
constexpr reference& operator=(bool x) noexcept;
10705+
constexpr reference& operator=(const reference& x) noexcept;
10706+
constexpr const reference& operator=(bool x) const noexcept;
1067710707
\end{itemdecl}
1067810708

1067910709
\begin{itemdescr}
@@ -10687,6 +10717,21 @@
1068710717
\tcode{*this}.
1068810718
\end{itemdescr}
1068910719

10720+
\indexlibrarymember{flip}{bitset::reference}%
10721+
\begin{itemdecl}
10722+
constexpr reference& flip() noexcept;
10723+
\end{itemdecl}
10724+
10725+
\begin{itemdescr}
10726+
\pnum
10727+
\effects
10728+
Equivalent to \tcode{*this = !*this}.
10729+
10730+
\pnum
10731+
\returns
10732+
\tcode{*this}.
10733+
\end{itemdescr}
10734+
1069010735
\indexlibrarymember{swap}{bitset::reference}%
1069110736
\begin{itemdecl}
1069210737
constexpr void swap(reference x, reference y) noexcept;
@@ -10706,45 +10751,6 @@
1070610751
\end{codeblock}
1070710752
\end{itemdescr}
1070810753

10709-
\indexlibrarymember{flip}{bitset::reference}%
10710-
\begin{itemdecl}
10711-
constexpr reference& reference::flip() noexcept;
10712-
\end{itemdecl}
10713-
10714-
\begin{itemdescr}
10715-
\pnum
10716-
\effects
10717-
Equivalent to \tcode{*this = !*this}.
10718-
10719-
\pnum
10720-
\returns
10721-
\tcode{*this}.
10722-
\end{itemdescr}
10723-
10724-
\pnum
10725-
The functions described in \ref{template.bitset} can report three kinds of
10726-
errors, each associated with a distinct exception:
10727-
\begin{itemize}
10728-
\item
10729-
an
10730-
\term{invalid-argument}
10731-
error is associated with exceptions of type
10732-
\tcode{invalid_argument}\iref{invalid.argument};
10733-
\indexlibraryglobal{invalid_argument}%
10734-
\item
10735-
an
10736-
\term{out-of-range}
10737-
error is associated with exceptions of type
10738-
\tcode{out_of_range}\iref{out.of.range};
10739-
\indexlibraryglobal{out_of_range}%
10740-
\item
10741-
an
10742-
\term{overflow}
10743-
error is associated with exceptions of type
10744-
\tcode{overflow_error}\iref{overflow.error}.
10745-
\indexlibraryglobal{overflow_error}%
10746-
\end{itemize}
10747-
1074810754
\rSec3[bitset.cons]{Constructors}
1074910755

1075010756
\indexlibraryctor{bitset}%

0 commit comments

Comments
 (0)