Concept Maps using C++23 Library Tech - Indirection to APIs for a Concept - Steve Downey - C++Now 24 @CppNow
Concept Maps using C++23 Library Tech - Indirection to APIs for a Concept - Steve Downey - C++Now 24  @CppNow
Uploaded October 2024 | Updated December 2026, 3 hours ago
cppnow.org
---

Concept Maps using C++23 Library Tech - Indirection to APIs for a Concept - Steve Downey - C++Now 2024
---

C++0x Concepts included a feature called "Concept Maps," which allowed a set of functions, types, and template definitions to be associated with a concept and the map to be specialized for types that meet that concept. This allowed for open extension of a concept. A definition could be provided that allows an algorithm to operate in terms of the API that concept presents, and the map would then define how those operations are implemented for a particular type. This is similar to how typeclasses work in Haskell.

The feature was very general, and was lost as part of the Concepts-Lite proposal that was eventually adopted. This loss of a level of indirection means that the APIs for a concept must be implemented by those names for a type, even when those names are not particularly good choices in the natural domain of a type rather than in the domain as a concept. The proliferation of transform functions for a functorial map is such a problem. It is also a problem when adapting types that are closed for extension or do not permit member functions.

In this talk, I will demonstrate a technique using inline variable templates that deliver many of the benefits of concept maps -- at the cost of some syntactic noise in the use in algorithms -- and some advanced machinery which allows minimal definitions of a basis set of operations that can be used to implement the rest of the map. In particular, we will discuss using deducing this (P0847) in addition to -- not as a replacement for -- the Curiously Recurring Template Pattern, which allows syntactically checked definitions of the minimal basis set.

To make the technique concrete, I will present a simple binary tree data structure that uses tags to classify the nodes. The tags are required to model the monoid concept, which requires that the tag type have a binary operation and an instance that is an identity for that operation. Integers with the identity element 0 and the operation plus form a monoid. Using different operations and identity elements, the tree can represent a data structure that provides sequenced indexed access – like std::vector or std::deque, a priority queue – like std::priority_queue, or searchability – like std::map, without changes to the core data structure. The binary tree operations are modeled after the more complicated fingertree data structure, which shares the flexible characteristics provided by tags with much greater efficiency.
---

Slides: github.com/boostcon/cppnow_presentations_2024/blob/main/Presentations/Concept_Maps_using_Cpp23_Library_Tech.pdf


---

Steve Downey

Steve Downey has been a programmer for more than 30 years. Steve graduated from SUNY Purchase with a BS in Mathematics. A Computer Science degree would have involved two classes before 11:00 am, so was impossible.
He has worked at Bloomberg since 2003, and is currently working as an Engineer on the C++ Infrastructure team.
---

C++Now 2025 - 28th April - 2nd May
C++Now is an annual onsite international C++ programming and coding conference held in Aspen, Colarado. For all C++ developers, C++ software engineers and those involved with the C++ language, CppNow provides an indepth and technical content provided by the best and brightest C++ experts of the C++ world.
Annual CppNow Conference - cppnow.org
linkedin.com/company/cppnow
twitter.com/cppnow
facebook.com/CppNow
reddit.com/r/CppNow
https://mastodon.social/@cppnow
think-cell develops one of the world’s leading PowerPoint applications, with C++ at the core of everything we build, from layout algorithms to deep integration with Microsoft Office. Interested in working on challenging C++ problems with real-world impact? Explore our open roles: think-cell.com/en/career/tech
---

Videos Filmed & Edited By Bash Films: bashfilms.com
YouTube Channel Managed & Optimized By Digital Medium Ltd: events.digital-medium.co.uk
---

#boost #cpp #cplusplusprogramming #codingconcepts #cppprogramming
Concept Maps using C++23 Library Tech - Indirection to APIs for a Concept - Steve Downey - C++Now 24Undefined Behavior From the Compiler’s Perspective - Shachar Shemesh - C++Now 2025Extending std::execution - Implementing Custom Algorithms with Senders & Receivers - C++Now 2025Towards Async Everything Part 2 - Scopes, Construction, and Destruction - Robert Leahy - C++Now 2026CPS in Cmake - Marching Towards Standard C++ Dependency Management - Bill Hoffman - C++Now 2025Keynote Session Preview - C++ Painkillers by Anastasia Kazakova with @cppeventsWhen Abstractions Fix Too Much - Towards Flexible Library Design - Patrick Roberts - C++Now 2026C++ is a Metacompiler - Daniel Nikpayuk - C++Now 2024C++ Program Correctness and its Limitations - David Sankel - C++Now 2025Post-Modern Cmake - From 3.0 to 4.0 - Vito Gamberini - C++Now 2025Senders For Existing Asynchronous Interfaces - Dietmar Kühl - C++Now 2026C++ as a Microscope Into Hardware - Linus Boehm - C++Now 2025
CppNow |

Concept Maps using C++23 Library Tech - Indirection to APIs for a Concept - Steve Downey - C++Now 24

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER