Namespaces
Variants

std::bitset<N>::all, std::bitset<N>::any, std::bitset<N>::none

cppreference.net에서 가져옴
 
 
유틸리티 라이브러리
일반 유틸리티
관계 연산자 (C++20에서 폐기됨)
정수 비교 함수
(C++20)(C++20)(C++20)    
(C++20)
Swap 및 타입 연산
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
공통 어휘 타입
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
bool all() const;
(1) (C++11부터 noexcept)
(C++23부터 constexpr)
bool any() const;
(2) (C++11부터 noexcept)
(C++23부터 constexpr)
bool none() const;
(3) (C++11부터 noexcept)
(C++23부터 constexpr)
1) 모든 비트가 true로 설정되어 있는지 확인합니다.
2) 어떤 비트가 true로 설정되어 있는지 확인합니다.
3) 비트 중 true로 설정된 것이 없는지 확인합니다.

반환값

1) true 모든 비트가 true 로 설정된 경우, 그렇지 않으면 false .
2) true 비트 중 하나라도 true 로 설정되어 있으면, 그렇지 않으면 false 입니다.
3) true 만약 어떤 비트도 true 로 설정되지 않은 경우, 그렇지 않으면 false .

예제

#include <bitset>
#include <iostream>
int main()
{
    std::bitset<4> b1("0000");
    std::bitset<4> b2("0101");
    std::bitset<4> b3("1111");
    std::cout
        << "bitset\t" << "all\t" << "any\t" << "none\n"
        << b1 << '\t' << b1.all() << '\t' << b1.any() << '\t' << b1.none() << '\n'
        << b2 << '\t' << b2.all() << '\t' << b2.any() << '\t' << b2.none() << '\n'
        << b3 << '\t' << b3.all() << '\t' << b3.any() << '\t' << b3.none() << '\n';
}

출력:

bitset  all any none
0000    0   0   1
0101    0   1   0
1111    1   1   0

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 693 C++98 멤버 함수 all() 가 제공되지 않았음 제공됨

참고 항목

true 로 설정된 비트 수를 반환합니다
(public member function)
(C++20)
부호 없는 정수에서 1 비트의 개수를 셉니다
(function template)