std::convertible_to(3cxx)

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

✨ std::convertible_to(3cxx) ✨

okay bestie, so std::convertible_to is a thing and it lives in libstdc++ and it's literally a concept πŸ’… from the <concepts> girlies, specifically the one catalogued as [concept.convertible]. It's the "concept convertible_to". That's the name, that's the vibe. Periodt.


🌸 NAME 🌸

std::convertible_to β€” [concept.convertible], concept convertible_to πŸ¦‹


✨ SYNOPSIS ✨

First things first, you gotta let it in the door:

#include <concepts>

πŸŽ€ Concept definition πŸŽ€

here's the whole glow-up, no cap, copy it exactly:

template<typename _From, typename _To>
concept std::convertible_to =  is_convertible_v<_From, _To>
      && requires { static_cast<_To>(std::declval<_From>()); }

so the way that works πŸ‘‘ β€” it's is_convertible_v<_From, _To> AND a requires clause that checks static_cast<_To>(std::declval<_From>()) actually compiles. Both. Not one or the other. Both. It's giving "you have to pass the vibe check AND the follow-up vibe check" πŸ’€


πŸ’œ Detailed Description πŸ’œ

[concept.convertible], concept convertible_to. fr fr. that's the whole lore ✨


🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code. not me getting auto-generated 😭 iconic behaviour honestly, it wrote itself 🫢


okay that's the whole page bestie, love that for us πŸ’– this lil masterpiece came straight out of libstdc++, and yes std::convertible_to(3cxx) really is the whole header/footer situation up in here. byeeee πŸŒΈπŸ¦‹βœ¨