~/lightning

Checking Functor Arguments in C++

Lightningat ACCU 2024 · 2024-04-17..04-20· [c-and-cpp]
links:none on file
slides:none on file

Templates that take user functors can silently accept unsafe implicit conversions; the solution uses a deleted conversion operator specialized for the types to check and a small templated conversion checker invoked inside a static_assert so overload resolution fails when an undesired conversion would occur. The compiler then produces an ambiguity/error pointing at the user call, preventing signed/unsigned surprises, avoids blaming library internals, and reliably stops compilation when conversions are wrong.

AI-written summary · about

~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.