CppCast cover image

C++ Game Development at Blizzard

CppCast

00:00

How to Implement a Transparent Comparator in C++

The article also made me think, because the day before I'd run into the same kind of problem that is looking up an item in a set where what you want to look up isn't the actual value type. And I had found, I thought to myself, there must be a way to do this. And I looked on Cp reference and indeed I found that set supports lookup with a transparent comparator. The other crucial thing is you need to define a type, a type def inside that that struct, just called "transparent" So you can say using is transparent equals int or whatever. That is a signal to the set, to the standard library that your operator is transparent.

Play episode from 10:32
Transcript

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app