std::vector::flip(3)
π std::vector::flip(3) π
okay so this page lives in the C++ Standard Libary manual β yes, that's the spelling the source uses, and we are not gaslighting you about it β and it's all about std::vector::flip. bestie, it's a tiny member function with main character energy. π
β¨ NAME β¨
std::vector::flip - std::vector::flip
πΈ Synopsis πΈ
Defined in header <vector>
void flip(); (until C++20)
constexpr void flip(); (since C++20)
Toggles each bool in the vector (replaces with its opposite value).
π Parameters π
(none)β no arguments, bestie. zero. nada. the void of parameters. π«Ά
π¦ Return value π¦
(none)β it returns nothing. it's givingvoidenergy. β¨
π₯ Example π₯
okay, run this code, it's literally right there:
// Run this code
#include <iostream>
#include <vector>
void print(const std::vector<bool>& vb)
{
for (const bool b : vb)
std::cout << b;
std::cout << '\n';
}
int main()
{
std::vector<bool> v{0, 1, 0, 1};
print(v);
v.flip();
print(v);
}
π Output π
0101
1010
π See also π
operator[]β access specified element (public member function ofstd::vector<T,Allocator>)flipβ toggles the values of bits (public member function ofstd::bitset<N>)
source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::vector::flip(3) β k bye bestie, go flip some bools πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms