From: Luciano Moreira - igLnx <lucianolnx@ig.com.br>
To: linux-c-programming@vger.kernel.org
Subject: STL - creating std::map key higher than double
Date: Wed, 20 Oct 2004 16:42:06 -0300 [thread overview]
Message-ID: <4176BF8E.5010107@ig.com.br> (raw)
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
next reply other threads:[~2004-10-20 19:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 19:42 Luciano Moreira - igLnx [this message]
2004-10-26 12:55 ` STL - creating std::map key higher than double Luciano Moreira - igLnx
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4176BF8E.5010107@ig.com.br \
--to=lucianolnx@ig.com.br \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.