[omniORB] about STL used in omniORB (sorry for last same subject email)
Visscher, Bruce
VISSCHB@RJRT.com
Fri Aug 23 18:04:01 2002
This is a multi-part message in MIME format.
------=_NextPartTM-000-74d39622-7030-4faa-b828-0470b601f57f
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
> This question may be not suitble here(sorry for
> that),but I am confused on the results.
Yes, it is somewhat off topic.
> I use std::map in one omniORB servlet: below is its
> definition in .h file:
> "
> struct eqstr
> {
> bool operator()(const char* s1, const char*=20
> s2) const
> {
> return strcmp(s1, s2) =3D=3D 0;
> }
> };
>=20
> //Rule is one struct defined in IDL file
> typedef map<const char*, Rule, eqstr > Rules_Map;
> Rules_Map rule_map;
The third template argument of map should provide an
ordering relation. You have supplied an equivalence
relation. This will not work.
I would recommend using std::string rather than pointer
to const char. That way you can use the default (std::less)
for the comparitor. You also won't have to worry about
allocation issues. You may need to convert between
std::string and CORBA::String_var (to make it more on topic)
and/or pointer to char but I think it would be well worth it.
Technically, you could rename eqstr to ltstr and
"return strcmp(s1, s2) < 0;" but you would be left with the
allocation issues which I think could get tricky in
a multithreaded environment.
HTH,
Bruce
------=_NextPartTM-000-74d39622-7030-4faa-b828-0470b601f57f
Content-Type: text/plain;
name="InterScan_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="InterScan_Disclaimer.txt"
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information. If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.
------=_NextPartTM-000-74d39622-7030-4faa-b828-0470b601f57f--