std::common_with(3cxx)
π 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 ππ¦π
π¦ where this page comes from
- ubuntu resolute: libstdc++-12-doc 12.5.0-9ubuntu1
- ubuntu resolute: libstdc++-13-doc 13.4.0-10ubuntu1
- ubuntu resolute: libstdc++-16-doc 16-20260322-1ubuntu1
- ubuntu stonking: libstdc++-12-doc 12.5.0-9ubuntu1
- ubuntu stonking: libstdc++-13-doc 13.5.0-1ubuntu1
- ubuntu stonking: libstdc++-16-doc 16.2.0-3ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms