C++Now 2017 has ended
Back To Schedule
Friday, May 19 • 11:00am - 12:30pm
Restoring Your Sanity: An Approach to Dealing with Reference Types in the Generic Programming Paradigm

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Slides: https://github.com/boostcon/cppnow_presentations_2017/blob/master/05-19-2017_friday/restoring_your_sanity_an_approach_to_dealing_with_reference_types_in_the_generic_programming_paradigm__matt_calabrese__cppnow_05-19-2017.pdf
Video: https://www.youtube.com/watch?v=hKIYbf1fsLw

When specifying datastructures using the generic programming paradigm, we explicitly require or assume certain properties of our input types. For instance, in order for a standard container to make sense, you should give it a type that is at least some non-conflicting subset of the Regular concept. Your value type should be movable, and if it is copyable and copy-assignable as well, the semantics of those operations should be consistent in meaning with those of a Regular type. Violating these requirements results in code that will either not compile at all, or will have semantics that may be both useless and totally inconsistent with other instantiations. In brief, don't attempt to create a vector of a reference type or a vector of a proxy type such as vector<bool>::reference.

And yet despite that totally reasonable restriction, we sometimes encounter real-world, higher-level generic code that *seems* to need or want to be able to use generic datastructures with reference types or proxy types. Is this higher-level code simply in error and in conflict with generic programming principles, or are the details a bit more subtle? In this session, we will examine such cases and deduce what the expected semantics in such code actually is. We will further explore how it is that we can develop our datastructures of the future in a way that works not just with Regular objects, but with reference types and proxy types as well, and without making the existing semantics of our generic datatructures weaker or parametric.

Audience participation is encouraged and should lead to discussions. This session is expected to be controversial, but constructive for all library developers.

avatar for Matt Calabrese

Matt Calabrese

Software Engineer, Google
Matt Calabrese is a software engineer working primarily in C++. He started his programming career in the game industry and is now working on libraries at Google. Matt has been involved with the Boost community for over a decade and is currently a member of the Boost Steering Committee... Read More →

Friday May 19, 2017 11:00am - 12:30pm MDT
Hudson Commons