std::bitset<N>::reset

Sets bits to false.

# Declarations

bitset& reset();

(noexcept since C++11) (constexpr since C++23)

bitset& reset( std::size_t pos );

(constexpr since C++23)

# Parameters

# Return value

*this

# Example

#include <bitset>
#include <iostream>
 
int main()
{
    std::bitset<8> b(42);
    std::cout << "Bitset is         " << b << '\n';
    b.reset(1);
    std::cout << "After b.reset(1): " << b << '\n';
    b.reset();
    std::cout << "After b.reset():  " << b << '\n';
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2250C++98the behavior was undefined if pos doesnot correspond to a valid bit positionalways throws anexception in this case

# See also