@@ -379,15 +379,204 @@ Rebase on the current draft, change "exchanges the contents" to
379379new subclauses.
380380</p >
381381
382+ <superseded >
383+ <p >
384+ This wording is relative to <paper num =" N4988" />.
385+ </p >
386+
387+ <ol >
388+
389+ <li ><p >Add to the synopsis in <sref ref =" [vector.bool.pspc]" /> p1:</p >
390+
391+ <blockquote >
392+ <pre >
393+ [… ]
394+ <i >// bit reference</i >
395+ class reference {
396+ friend class vector;
397+ constexpr reference() noexcept;
398+
399+ public:
400+ constexpr reference(const reference& ) = default;
401+ constexpr ~reference();
402+ constexpr operator bool() const noexcept;
403+ constexpr reference& operator=(bool x) noexcept;
404+ constexpr reference& operator=(const reference& x) noexcept;
405+ constexpr const reference& operator=(bool x) const noexcept;
406+ constexpr void flip() noexcept; <i >// flips the bit</i >
407+
408+ <ins > friend constexpr void swap(reference x, reference y) noexcept;
409+ friend constexpr void swap(reference x, bool& y) noexcept;
410+ friend constexpr void swap(bool& x, reference y) noexcept;</ins >
411+ };
412+ [… ]
413+ </pre >
414+ </blockquote >
415+ </li >
416+
417+ <li ><p >Remove the static <tt >swap</tt > function from the same synopsis:</p >
418+
419+ <blockquote >
420+ <pre >
421+ [… ]
422+ constexpr void swap(vector& )
423+ noexcept(allocator_traits< Allocator> ::propagate_on_container_swap::value ||
424+ allocator_traits< Allocator> ::is_always_equal::value);
425+ <del >static constexpr void swap(reference x, reference y) noexcept;</del >
426+ constexpr void flip() noexcept; <i >// flips all bits</i >
427+ constexpr void clear() noexcept;
428+ [… ]
429+ </pre >
430+ </blockquote >
431+ </li >
432+
433+ <li ><p >Modify the paragraphs below the synopsis as shown:</p >
434+
435+ <blockquote >
436+ <p >
437+ -4- <tt >reference</tt > is a class that simulates the behavior of references of a single bit in <tt >vector< bool> </tt >.
438+ The conversion function returns <tt >true</tt > when the bit is set, and <tt >false</tt > otherwise. The assignment
439+ operators set the bit when the argument
440+ <del >is (convertible to)</del >
441+ <ins >converts to</ins >
442+ <tt >true</tt > and clear it otherwise.
443+ <tt >flip</tt > reverses the state of the bit.
444+ </p >
445+ <pre >
446+ <ins >constexpr void reference::flip() noexcept;</ins >
447+ </pre >
448+ <blockquote >
449+ <p >
450+ <ins >-?- <i >Effects:</i > <tt >*this = !*this;</tt ></ins >
451+ </p >
452+ </blockquote >
453+ <pre ><ins >
454+ constexpr void swap(reference x, reference y) noexcept;
455+ constexpr void swap(reference x, bool& y) noexcept;
456+ constexpr void swap(bool& x, reference y) noexcept;
457+ </ins ></pre >
458+ <blockquote >
459+ <p >
460+ <ins >-?- <i >Effects:</i > Exchanges the values denoted by <tt >x</tt > and <tt >y</tt > as if by:</ins >
461+ </p >
462+ <blockquote ><pre >
463+ <ins >bool b = x;
464+ x = y;
465+ y = b;</ins >
466+ </pre ></blockquote >
467+ </blockquote >
468+
469+ <pre >
470+ constexpr void flip() noexcept;
471+ </pre >
472+ <blockquote >
473+ <p >
474+ -1- <i >Effects:</i > Replaces each element in the container with its complement.
475+ </p >
476+ </blockquote >
477+ <pre >
478+ <del >constexpr static void swap(reference x, reference y) noexcept;</del >
479+ </pre >
480+ <blockquote >
481+ <p >
482+ <del >-6- <i >Effects:</i > Exchanges the contents of <tt >x</tt > and <tt >y</tt > as if by:</del >
483+ </p >
484+ <blockquote ><pre >
485+ <del >bool b = x;
486+ x = y;
487+ y = b;</del >
488+ </pre ></blockquote >
489+ </blockquote >
490+ <pre >
491+ template< class Allocator> struct hash< vector< bool, Allocator>> ;
492+ </pre >
493+ <blockquote >
494+ <p >
495+ -7- The specialization is enabled (<sref ref =" [unord.hash]" />).
496+ </p >
497+ </blockquote >
498+ </blockquote >
499+ </li >
500+
501+ <li ><p >Create a new subclause [depr.vector.bool.swap] after <sref ref =" [depr.format]" /></p >
502+
503+ <blockquote >
504+ <p >
505+ <ins ><b >D.? Deprecated <tt >vector< bool, Allocator> </tt > swap [depr.vector.bool.swap]</b ></ins >
506+ <p />
507+ <ins >-?- The following member is declared in addition to those members specified in <sref ref =" [vector.bool]" />:</ins >
508+ </p >
509+ <pre >
510+ <ins >namespace std {
511+ template< class Allocator> class vector< bool, Allocator> {
512+ public:
513+ static constexpr void swap(reference x, reference y) noexcept;
514+ };
515+ }</ins >
516+ </pre >
517+ <pre >
518+ <ins >static constexpr void swap(reference x, reference y) noexcept;</ins >
519+ </pre >
520+ <blockquote >
521+ <p >
522+ <ins >-?- <i >Effects:</i > Exchanges the values denoted by <tt >x</tt > and <tt >y</tt > as if by:</ins >
523+ </p >
524+ <blockquote ><pre >
525+ <ins >bool b = x;
526+ x = y;
527+ y = b;</ins >
528+ </pre ></blockquote >
529+ </blockquote >
530+ </blockquote >
531+ </li >
532+
533+ </ol >
534+
535+ </superseded >
536+
537+ <note >2025-02-07; Jonathan provides improved wording</note >
538+ <p >
539+ Add `swap` for `bitset::reference`, as proposed in LWG <iref ref =" 4187" />.
540+ </p >
541+
382542</discussion >
383543
384544<resolution >
385545<p >
386- This wording is relative to <paper num =" N4988 " />.
546+ This wording is relative to <paper num =" N5001 " />.
387547</p >
388548
389549<ol >
390550
551+ <li ><p >Modify <sref ref =" [template.bitset.general]" /> as indicated:</p >
552+
553+ <blockquote >
554+ <pre >
555+ namespace std {
556+ template< size_t N> class bitset {
557+ public:
558+ // <i >bit reference</i >
559+ class reference {
560+ public:
561+ constexpr reference(const reference& ) = default;
562+ constexpr ~reference();
563+ constexpr reference& operator=(bool x) noexcept; // <i >for b[i] = x;</i >
564+ constexpr reference& operator=(const reference& ) noexcept; // <i >for b[i] = b[j];</i >
565+ constexpr bool operator~() const noexcept; // <i >flips the bit</i >
566+ constexpr operator bool() const noexcept; // <i >for x = b[i];</i >
567+ constexpr reference& flip() noexcept; // <i >for b[i].flip();</i >
568+ <ins > friend constexpr void swap(reference x, reference y) noexcept;
569+ friend constexpr void swap(reference x, bool& y) noexcept;
570+ friend constexpr void swap(bool& x, reference y) noexcept;</ins >
571+ };
572+ [… ]
573+ };
574+ [… ]
575+ }
576+ </pre >
577+ </blockquote >
578+ </li >
579+
391580<li ><p >Add to the synopsis in <sref ref =" [vector.bool.pspc]" /> p1:</p >
392581
393582<blockquote >
0 commit comments