C++ Logo

std-proposals

Advanced search

Re: Proposal for Explicit Index Types

From: Robert Ramey <ramey_at_[hidden]>
Date: Sun, 7 Nov 2021 06:56:58 -0800
On 11/6/21 12:06 PM, Arthur O'Dwyer via Std-Proposals wrote:

>
> This part of your proposal is known as "strong typedefs," and there is a
> /*lot*/ of literature on it. Strong typedefs are /*hard*/.
> https://quuxplusone.github.io/blog/2018/06/12/perennial-impossibilities/#strong-typedefs
> <https://quuxplusone.github.io/blog/2018/06/12/perennial-impossibilities/#strong-typedefs>
> (Particularly the bulleted list A-through-K in that post.)

...

Very readable and interesting post.

 From the above post:

"And finally, if you said “no” to all of B, C, D, E, F, G, and H: you
haven’t really got a strong “typedef” anymore. It’s more like you just
made a completely new type, lacking the basic amenities such as equality
comparison, swappability, and hashability."

Maybe you might want to take this to it's logical conclusion with
another blog post/conference talk. A generalized strong_typedef is not
a great idea. "How to make a specific type for indexing into your
particular collection."

Robert Ramey

Received on 2021-11-07 08:57:14