std::common_with(3cxx)

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

πŸ’– NAME πŸ’–

std::common_with β€” it's giving [concept.common], concept common_with. Bestie, this is page std::common_with(3cxx) and we're gonna stan her properly.


✨ SYNOPSIS ✨

#include <concepts>

πŸ¦‹ Concept definition πŸ¦‹

template<typename _Tp, typename _Up>
concept std::common_with =  same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>>
      && requires {
        static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>());
        static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>());
      }
      && common_reference_with<add_lvalue_reference_t<const _Tp>,
                               add_lvalue_reference_t<const _Up>>
      && common_reference_with<add_lvalue_reference_t<common_type_t<_Tp, _Up>>,
                               common_reference_t<
                                 add_lvalue_reference_t<const _Tp>,
                                 add_lvalue_reference_t<const _Up>>>

πŸ‘‘ Detailed Description πŸ‘‘

okay so β€” this concept lives in [concept.common] and her whole name is common_with. That's it, that's the description, no cap. The Doxygen-generated page just hands you the tag [concept.common] and the concept name common_with and lets you read the definition above for yourself. πŸ’…

Look at what she's checking, though: she wants common_type_t<_Tp, _Up> to be same_as common_type_t<_Up, _Tp> (yes bestie, order doesn't matter), she wants static_cast of both std::declval<_Tp>() and std::declval<_Up>() into common_type_t<_Tp, _Up> to be valid inside a requires block, and then she stacks two common_reference_with requirements on top β€” one for add_lvalue_reference_t<const _Tp> and add_lvalue_reference_t<const _Up>, and one for add_lvalue_reference_t<common_type_t<_Tp, _Up>> paired with common_reference_t<add_lvalue_reference_t<const _Tp>, add_lvalue_reference_t<const _Up>>. 🌸

fr fr, if you're implementing something that relies on this concept, read the definition character by character. Not a single && is decorative here, iykyk.

🫢 Author 🫢

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a bestie, just the Doxygen machine doing its lil thing. πŸ™ˆ


and that's the whole page, periodt. this was std::common_with(3cxx) from the libstdc++ crew β€” mwah, go read your <concepts> header, ily, bye πŸ’–πŸ¦‹πŸŽ€