YoVDO

The Best Type Traits that C++ Doesn't Have

Offered By: CppNow via YouTube

Tags

C++Now Courses C++ Courses Benchmarking Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the intricacies of C++ type traits in this comprehensive conference talk from C++Now 2018. Dive into three proposed type traits that could enhance C++ functionality: is_trivially_relocatable_v, is_trivially_equality_comparable_v, and tombstone_traits. Examine how these traits can optimize operations like vector resizing, hash-table rehashing, and compare-exchange on atomic. Analyze benchmarks demonstrating performance improvements, particularly for vector operations. Discover how the introduction of "operator spaceship" in C++2a impacts trivial comparability. Learn about the concept of "tombstone traits" and how they can expose spare representations in types like bool and reference_wrapper. Gain insights into implementing these traits in library classes such as optional and cuckoo_hash. Follow along with code examples, benchmarks, and in-depth explanations of the design criteria and potential compiler support for these proposed traits.

Syllabus

Intro
Outline
Rules for std::vector reallocation
Relocating trivially copyable types
Relocating non-trivial types
Algorithm uninitialized_relocate
Optimizing uninitialized_relocate
By the way: convenience helpers
Two new customization points
Implementing allocator_traits::htcad
TLDR / dependency graph
Benchmark results
Motivating "comparison"
Compiler support required?
Compiler support attained(?)
Another problem: naming
What is the meaning of "trivial"?
Motivating "tombstones"
Design criteria
One new traits class
Specialization for string
Specialization for bool
optional uses tombstone_traits
Recursing on tombstone_traits
Benchmark design


Taught by

CppNow

Related Courses

Your Favorite Undefined Behavior in C++
CppNow via YouTube
Under the Hood - Assembly, System Calls, and Hardware in C++
CppNow via YouTube
Carbon Language Successor Strategy - From C++ Interop to Memory Safety
CppNow via YouTube
Value Oriented Programming Part 1 - You Say You Want to Write a Function
CppNow via YouTube
Introducing a Memory-Safe Successor Language in Large C++ Code Bases
CppNow via YouTube