Hiding template parameters with dynamic dispatch

| No Comments

In my last post, I mentioned a problem (choosing between one of several templated classes based on information that won't be available until runtime) and also mentioned a workaround involving virtual dispatch, in which the templated class extends a non-templated class. This doesn't address all of the concerns I set out with regard to other solutions, but it is rather cleaner than any of them since it makes conditional dispatch implicit. Here's an example of this very simple workaround as applied to a trivial class:

Leave a comment

About this Entry

This page contains a single entry by Will Benton published on July 1, 2009 3:08 PM.

A problem of dependent types was the previous entry in this blog.

Introducing SPQR is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Powered by Movable Type 4.25