This video presents a technique for achieving IDE autocomplete for template arguments in C++ template libraries by defining default interfaces for template arguments using macro magic and template metaprogramming. The approach involves defining types inside classes to help template metaprogrammers access template arguments, creating interfaces that IDEs can recognize for autocomplete suggestions, and documenting template arguments to improve IDE support. The speaker demonstrates that while this technique works for template argument interfaces, it does not fully solve the autocomplete problem, as IDEs cannot reliably pick up on these custom interfaces. The technique is agnostic to both the IDE and C++ standard, making it a portable solution for template libraries that avoid inheritance to prevent virtual function call overhead.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Lightning Talk: Poor Man’s Autocomplete for Template Arguments - Max Sagebaum - CppCon 2025Added:
Something really valuable about uh actually attending and being here in person is having the opportunity to actually ask the speakers while they're there. Go up to the microphone, ask a question that you have or meet them after the talk, chat them up in the hall. There's just a lot of opportunities if you know something isn't really clear to you to kind of just get in there and get a much clearer answer if you need one.
Okay. Poor persons autocomplete for template arguments. Context is important. I'm working on a template library. Heavy template meta programming CRTP. It was C++ 11 since two months. We switched to T C++ 17. That's nice.
Template arguments are mostly well- definfined interfaces there, but we don't want to inherit inherit from them because then we would have a virtual fun multiple virtual function calls on every numerical operation. So not nothing you want to do. Long story short, I never have ever any template automatic completion in this library. Okay, let's demo something I want to show you. So for example, we have here draw interface. We have our strct a that gets a type name and this is always a drawable type. So what can we do? First thing we can define our type inside the class. I think that's a really good thing to do always because this helps template motor meta programmers to get the template arguments for your class.
If you don't do this, it can be really hard to get them. So second step, let's add some magic.
Okay, let's add some other ingredients to the magic that we say okay this should be a draw interface.
So but now we also need to define something. So what what is when we are in an IDE and then we actually need to say okay we are in an IDE and now what we can do is here say okay a dot draw we have autocomplete of our template arguments and we have documentation our template arguments what they should be it's macro magic so I I know you don't like this guys but if you go here to standard conditional not ID E first thing. So it should be the second one.
Doesn't work unfortunately. I would like to have this but doesn't work for whatever reason. I don't know.
Um yeah, that's what I wanted to show you.
Um so that's a summary I've already given you. Um well I can't do this. So define an interface for your template arguments. add a macro for switching between argument and interfaces and then always document your template arguments that helps you also with autocomplete.
Okay, what about concepts? If you go to newer CPP versions, we could say derived from draw interface, the problem is Biona put this out in his talk that's too restrictive. So then we really have to need the inheritance. So this doesn't work. Um and we still don't have any autocomplete but idees could pick up on this and say okay if it's derived from then we actually could do the autocomplete there. Um what about reflection? We could reflect on this have a supports interface concept and add the reflection types the meta types in there and then generate something that a reflection that says okay do you have all the methods then we have no restrictions there's still no autocomplete and that should but probably be picked up by celd or the IDE developers so that's all thank you very much if you have other ideas how to achieve autocomplete for um template arguments. Please talk to me later. Thank you very much. [applause] [applause]
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











