C++ Logo

std-discussion

Advanced search

Re: Trying to solve how to do a std::unordered_map<std::pair<..., ...>, ...>

From: Yongwei Wu <wuyongwei_at_[hidden]>
Date: Thu, 5 Oct 2023 20:55:17 +0800
On Thu, 5 Oct 2023 at 10:55, Aaron Gray via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> On Tue, 3 Oct 2023 at 21:59, Thiago Macieira <thiago_at_[hidden]> wrote:
> >
> > On Tuesday, 3 October 2023 12:06:47 PDT Aaron Gray wrote:
> > > Hi Thiago,
> > >
> > > What would you use instead for my use case which is memorization of a
> > > pair of types or type variables used for comparison and subtyping
> > > predicates for a type system.
> >
> > Create your own type. There's never a good reason to use std::pair.
>
> Why, what is your logic in its redundancy please ?
>

I think he meant creating a new struct or something like that, so that it
has a unique type and the fields have readable names. Not that one should
create a pair clone.

Specializing on your own type won't clash with other code, unless the full
type name itself clashes with the code.

-- 
Yongwei Wu
URL: http://wyw.dcweb.cn/

Received on 2023-10-05 12:55:30