다음을 통해 공유


vector<bool>::reference::flip

참조된 vector<bool> 요소의 부울 값을 반전합니다.

void flip();

예제

// vector_bool_ref_flip.cpp
// compile with: /EHsc /W4
#include <vector>
#include <iostream>

int main()
{
    using namespace std;
    cout << boolalpha;

    vector<bool> vb = { true, false, false, true, true };

    cout << "The vector is: " << endl << "    ";
    for (const auto& b : vb) {
        cout << b << " ";
    }
    cout << endl;

    vector<bool>::reference vbref = vb.front();
    vbref.flip();

    cout << "The vector with first element flipped is: " << endl << "    ";
    for (const auto& b : vb) {
        cout << b << " ";
    }
    cout << endl;
}

Output

The vector is:
    true false false true true
The vector with first element flipped is:
    false false false true true

요구 사항

헤더: <vector>

네임스페이스: std

참고 항목

참조

vector<bool>::reference 클래스

표준 템플릿 라이브러리