linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* STL - creating std::map key higher than double
@ 2004-10-20 19:42 Luciano Moreira - igLnx
  2004-10-26 12:55 ` Luciano Moreira - igLnx
  0 siblings, 1 reply; 2+ messages in thread
From: Luciano Moreira - igLnx @ 2004-10-20 19:42 UTC (permalink / raw)
  To: linux-c-programming

THE PROBLEM:
I never created a map<> object that has a key different from embbeded 
types. When I need a different key type, I create a union joinning my 
type with a large enough embbed type. A sample:
urion {
      myObject X; // Its size is less or equal to double size;
      double real_key;
};

Well, now I need a key larger than 128 bits, because it ll have about 48 
bytes. I tryed to create a map like as:
typedef std::map<myKeyType, stItem, std::less< myKeyType > > tpList;

But, off course, the compiler advised me that "less<>" cannot compare 
"myKeyType", then I implemented a "operator<" into "myKeyType". And now 
the problem is with "iterator".

MY QUESTIONS:
Does exist a way to get a map<> with a customized key ? Should I fix the 
compiling erros, building my own objects ?

Thanks,
Luciano


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: STL - creating std::map key higher than double
  2004-10-20 19:42 STL - creating std::map key higher than double Luciano Moreira - igLnx
@ 2004-10-26 12:55 ` Luciano Moreira - igLnx
  0 siblings, 0 replies; 2+ messages in thread
From: Luciano Moreira - igLnx @ 2004-10-26 12:55 UTC (permalink / raw)
  Cc: linux-c-programming

Hi guys ! No aswers, no comments, no questions unil now.

I fixed the problem, if some one wants to know how, please contact me.

Regards,
Luciano

Luciano Moreira - igLnx escreveu:

> THE PROBLEM:
> I never created a map<> object that has a key different from embbeded 
> types. When I need a different key type, I create a union joinning my 
> type with a large enough embbed type. A sample:
> urion {
>      myObject X; // Its size is less or equal to double size;
>      double real_key;
> };
>
> Well, now I need a key larger than 128 bits, because it ll have about 
> 48 bytes. I tryed to create a map like as:
> typedef std::map<myKeyType, stItem, std::less< myKeyType > > tpList;
>
> But, off course, the compiler advised me that "less<>" cannot compare 
> "myKeyType", then I implemented a "operator<" into "myKeyType". And 
> now the problem is with "iterator".
>
> MY QUESTIONS:
> Does exist a way to get a map<> with a customized key ? Should I fix 
> the compiling erros, building my own objects ?
>
> Thanks,
> Luciano
>
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-26 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-20 19:42 STL - creating std::map key higher than double Luciano Moreira - igLnx
2004-10-26 12:55 ` Luciano Moreira - igLnx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).