~/talk

Co- and Contra-: Adding a Little Variance

Talkat CppCon 2018 · 2018-09-23..09-28· [c-and-cpp, compilers-and-language-design]
links:none on file
slides:none on file

Claims that C++ lacks principled co/contravariance and that practical emulation is possible but brittle: shows language examples (C#, Scala, Java using out/in), demonstrates function_ref emulation and container adapters that convert vectors of cats to views of animals by computing subobject offsets and reinterpret_casts, and cites a real Thrust case where Thrust device_vector unified memory causes page faults and motivates smart references. Emulations compile and work but incur runtime cost, complex edge cases (multiple inheritance, mutability) and unsafe casts; true language support would simplify and make them safer.

AI-written summary · about

  1. 0:00Introduction
  2. 0:36Polymorphism
  3. 8:55Variants
  4. 12:57Other languages
  5. 14:37Java
  6. 15:10Mutability
  7. 16:05Contravariance
  8. 18:29Java Annotating
  9. 21:06Reference Types
  10. 23:00Implementation
  11. 26:20C
  12. 27:10Smart References
~/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.