1053310533namespace 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;
1062510611\tcode {bitset<N>}
1062610612describes an object that can store a sequence consisting of a fixed number of
1062710613bits, \tcode {N}.
10614+ The class \tcode {bitset<N>::reference} simulates a reference
10615+ to a single bit in the sequence.
1062810616
1062910617\pnum
1063010618Each bit represents either the value zero (reset) or one (set).
@@ -10644,12 +10632,54 @@
1064410632or 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+ \rSec 3[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 }
1066010690
1066110691\indexlibrarydtor {bitset::reference}%
1066210692\begin {itemdecl }
10663- constexpr reference:: ~reference();
10693+ constexpr ~reference();
1066410694\end {itemdecl }
1066510695
1066610696\begin {itemdescr }
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 }
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 }
1069210737constexpr void swap(reference x, reference y) noexcept;
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\rSec 3[bitset.cons]{Constructors}
1074910755
1075010756\indexlibraryctor {bitset}%
0 commit comments