Skip to content
0:00 / 0:00

#polymorphism#valuetypes#typeerasure

Better Code: Runtime Polymorphism - Sean Parent

NDC Conferences

230K subscribers • 107 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Sean Parent
  • An opinion. It argues one side of a question engineers disagree on.

Advanced. Deep dive for people who know the field.

79K views9 years ago2 recommendations

Software designProgramming languagesC++Design patternsSoftware architecture

Sean Parent demonstrates how to implement runtime polymorphism in C++ without using inheritance, using techniques like type erasure.

This talk explains why (and how) to implement polymorphism without inheritance in C++. The talk contains many C++ tips and techniques, including many new features from C++11. During the course of that talk a key feature from Photoshop will be demonstrated and implemented. NDC Conferences ndc-london.com ndcconferences.com

Why it's here

2 people recommend this

What people say. Recommended for its deep dive into avoiding virtual tables and implementing flexible runtime polymorphism in C++.

Moments people linked to

u/joonazanin r/ProgrammingLanguages • Recommends

On “Why do modern (functional?) languages favour immutability by default?”

> You don't want to generate a completely new 10Mpixel image every time you modify one pixel. Photoshop uses a persistent data structure for storing the image being edited because that is much easier than storing undo information for every type of edit. It doesn't require copying the whole image for one pixel, but for edits that modify the entire image it does copy the whole image. EDIT: source: link to this video
47View on Reddit

u/oilshellin r/ProgrammingLanguages • Recommends

On “Need pointers on implementing fast runtime polymorphism”

You might want to catch up on crazy template tricks C++ programmers are doing to avoid vtables :) There is sample code floating around. *Polymorphism != Virtual: Easy, Flexible Runtime Polymorphism Without Inheritance* link to this video *Better Code: Runtime Polymorphism - Sean Parent* link to this video I watched these videos a couple years ago, and they were interesting, although I mentally filed it under "crazy C++" :) Not something I would use in my own code but it may be worth it for specialized applications.