Re: std::pair<,>
From: Mike Wahler (mkwahler_at_mkwahler.net)
Date: 10/04/03
- Next message: Kevin Morenski: "Re: Spell-checking source code (Was: ISO Studies of underscores...)"
- Previous message: David Rubin: "Re: std::pair<,>"
- In reply to: David Rubin: "Re: std::pair<,>"
- Next in thread: Jonathan Mcdougall: "Re: std::pair<,>"
- Reply: Jonathan Mcdougall: "Re: std::pair<,>"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Oct 2003 22:05:39 GMT
"David Rubin" <bogus_address@nomail.com> wrote in message
news:3F7DF018.9637D997@nomail.com...
> Mike Wahler wrote:
>
> > > I wonder if there is a way to create a pair class
> > > using std::pair but typedef its first and second
> > > to x and y using C++.
> [snip]
> > >The only way I can think
> > > of is to subclass std::pair<,>.
> >
> > IMO no reason to.
> >
> > std::pair<T,T>(x,y);
>
> The question is, is a Point a pair? From the description of pair, it
> seems like the answer is yes.
Agreed.
> So, if you want a Point with members x and
> y, why not subclass?
Why not simply:
std::pair<int,int> coord(x,y);
or if you like:
typedef std::pair<int,int> Point;
Point coord(x,y);
??
-Mike
- Next message: Kevin Morenski: "Re: Spell-checking source code (Was: ISO Studies of underscores...)"
- Previous message: David Rubin: "Re: std::pair<,>"
- In reply to: David Rubin: "Re: std::pair<,>"
- Next in thread: Jonathan Mcdougall: "Re: std::pair<,>"
- Reply: Jonathan Mcdougall: "Re: std::pair<,>"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|