Negators(3)
okay so bestie, this is Negators(3) from the Library Functions Manual β and the NAME is literally Negators. That's the whole name, no cap. It's the little libstdc++ page about negation functors, and we're gonna get into it π .
π NAME π
Negators β that's the name, bestie. The page is called Negators(3), from the Library Functions Manual, and it's giving classic negation-functor energy.
π Classes
class std::binary_negate< _Predicate >β one of the negation functors. yep, that's the whole description, and we're keeping it.class std::unary_negate< _Predicate >β one of the negation functors. iconic.
β¨ Functions
template<typename _Predicate > unary_negate< _Predicate > std::not1 (const _Predicate &__pred)β thenot1function template, right here.template<typename _Predicate > binary_negate< _Predicate > std::not2 (const _Predicate &__pred)β thenot2function template, right here.
πΈ Detailed Description πΈ
okay so the functions not1 and not2 each take a predicate functor and return an instance of unary_negate or binary_negate, respectively. That's the whole glow-up. These classes are functors whose operator() performs the stored predicate function and then returns the negation of the result. So it does the thing, then flips the boolean. periodt.
For example, given a vector of integers and a trivial predicate, you get this iconic little setup:
struct IntGreaterThanThree
: public std::unary_function<int, bool>
{
bool operator() (int x) { return x > 3; }
};
std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree()));
The call to find_if will locate the first index (i) of v for which '!(v[i] > 3)' is true. That's the vibe: it finds the first one that is not greater than three. no cap.
The not1/unary_negate combination works on predicates taking a single argument. The not2/binary_negate combination works on predicates which take two arguments. simple as that, bestie π¦.
π₯ Function Documentation π₯
π template<typename _Predicate > unary_negate<_Predicate> std::not1 (const _Predicate & __pred) [inline]
One of the negation functors.
Definition at line 364 of file stl_function.h.
π template<typename _Predicate > binary_negate<_Predicate> std::not2 (const _Predicate & __pred) [inline]
One of the negation functors.
Definition at line 389 of file stl_function.h.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. so not a human author, just Doxygen doing its little automated thing π .
okay bestie, that's the whole manual page! it's libstdc++, dated 21 Apr 2009, and the page is Negators(3) β mwah, slay, bye πβ¨
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms