Multiple dispatch using compile-time metaprogramming

Seyed Hossein Haeri, Paul Keir

Research output: Contribution to conferencePresentation


We solve the multiple dispatch problem for a components-for-cases encoding of algebraic datatypes in C++. For the multi-method, the programmer is required to specify the decentralised match statements using overloads of template functions. Then, they employ a one-liner preprocessor macro, which expands to the real dispatcher. The expanded one-liner performs iterative pointer introspection to accomplish late-binding using overload resolution. Even though we present our solution for ADTs, one can use the same technology for other types too.
Original languageEnglish
Publication statusPublished - 4 Nov 2018
EventACM SIGPLAN Conference on Systems, Programming, Languages and Applications: Software for Humanity - Boston Park Plaza Hotel, Boston, United States
Duration: 4 Nov 20189 Nov 2018


ConferenceACM SIGPLAN Conference on Systems, Programming, Languages and Applications
Abbreviated titleSPLASH 2018
Country/TerritoryUnited States
Internet address


  • Metaprogramming
  • C++
  • Functional Programming


Dive into the research topics of 'Multiple dispatch using compile-time metaprogramming'. Together they form a unique fingerprint.

Cite this