std::bit_or(3)
okay bestie, welcome to std::bit_or(3) from the C++ Standard Libary β yep, βLibaryβ is literally how the header spells it, and we respect the source ππ
πΈ NAME πΈ
std::bit_or β std::bit_or. Thatβs the name, thatβs the whole name, main character energy from the jump πβ¨
β¨ Synopsis β¨
Defined in header <functional> β noted, bestie π«Ά
template< class T > (until C++14)
struct bit_or;
template< class T = void > (since C++14)
struct bit_or;
Function object for performing bitwise OR. Effectively calls operator| on type T. slay π
π¦ Specializations π¦
The standard library provides a specialization of std::bit_or when T is not specified, which leaves the parameter types and return type to be deduced. (since C++14)
bit_or<void>β function object implementingx | ydeducing parameter and return types(C++14)β class template specialization. this one ate π
π Member types π
result_typeβTβ (deprecated in C++17)(removed in C++20)first_argument_typeβTβ (deprecated in C++17)(removed in C++20)second_argument_typeβTβ (deprecated in C++17)(removed in C++20)
The way that these member types are obtained is via publicly inheriting std::binary_function<T, T, T>. (until C++11) β lowkey historic, highkey important π§
π Member functions π
operator()β returns the result of bitwise OR of two arguments (public member function). obsessed with the clarity, ngl β¨
π₯ std::bit_or::operator() π₯
T operator()( const T& lhs, const T& rhs ) const; (until C++14)
constexpr T operator()( const T& lhs, const T& rhs ) const; (since C++14)
Returns the result of bitwise OR of lhs and rhs. thatβs it, thatβs the function, iconic behavior π
π Parameters π
lhs, rhsβ values to compute bitwise OR of
π Return value π
The result of lhs | rhs. periodt π
β Exceptions β
May throw implementation-defined exceptions. vibe check: yes, it can throw, no cap π
π¦ Possible implementation π¦
constexpr T operator()(const T& lhs, const T& rhs) const
{
return lhs | rhs;
}
literally the blueprint, bestie β short, sweet, iconic π
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 660β Applied to:C++98β Behavior as published: function objects for bitwise operations are missing β Correct behavior: added. fr fr, they fixed it πΈ
source/version: http://cppreference.com Β· date: 2024.06.10 Β· manual: std::bit_or(3) β okay bestie, thatβs the cute sign-off, go forth and bitwise-OR responsibly πβ¨π«Ά
π¦ 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