std::weakly_incrementable(3cxx)

πŸ“¦
version 16-20260322 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– std::weakly_incrementable πŸ’–

okay bestie, welcome to the std::weakly_incrementable page, straight out of the libstdc++ manual, section 3cxx. it's a whole concept from the C++ standard library and yes it's giving main character energy. sit down, hydrate, let's go 🫢


✨ NAME ✨

std::weakly_incrementable β€” the vibe check for types that can be incremented with ++. like, they just gotta go up. that's it. that's the requirement. πŸ’…


🌸 SYNOPSIS 🌸

first thing's first, you gotta bring in the header:

#include <iterator>

πŸŽ€ Concept definition πŸŽ€

here's the whole thing, verbatim, no edits, no cap:

template<typename _Iter>
concept std::weakly_incrementable =  movable<_Iter>
      && requires(_Iter __i)
      {
        typename iter_difference_t<_Iter>;
        requires __detail::__is_signed_integer_like<iter_difference_t<_Iter>>;
        { ++__i } -> same_as<_Iter&>;
        __i++;
      }

like... look at her. she's literally doing so much in so few lines πŸ”₯


πŸ’œ Detailed Description πŸ’œ

Requirements on types that can be incremented with ++.

that's the whole thing bestie. a type has to be movable, it needs an iter_difference_t, that difference type has to be a signed-integer-like type, ++__i has to hand back _Iter& (same type, exactly, no sneaky conversions), and post-increment __i++ has to be a thing too. that's the checklist. slay ✨


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. so like, not a human author, a robot wrote it, and honestly? she ate πŸ’…


k byeee, this was libstdc++'s std::weakly_incrementable page in section 3cxx β€” go increment something, you're doing amazing sweetie πŸŒˆπŸ’–πŸŽ€

πŸ“¦ where this page comes from