Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: STL set/map...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 17 Topic 45770 of 46738
Post > Topic >>

Re: STL set/map w.r.t const char*

by dizzy <dizzy@[EMAIL PROTECTED] > May 6, 2008 at 03:48 PM

S S wrote:

> Dizzy, Ian
> 
> May be I am missing something, but my statement
> strcmp(s1, s2) < 0
> will give me the expression
> 
> return 0 < 0;
> 
> which is FALSE. Am I correct?

Correct.

> 
> if (0 < 0)
>  cout << "Its true";
> else
>  cout << "Its false";
> 
> It prints, Its false.

So? I said 2 elements are equivalent iff (!(elem1 < elem2) && !(elem2 <
elem1)). Let's take your example, let's compare "a" and "b" so we have
!(strcmp("a", "b")<0) && !(strcmp("b", "a")<0) which means false && true
which yields false so "a" and "b" are not equivalent, BUT, let's take "a"
and "a" and we have:
!(strcmp("a", "a")<0) && !(strcmp("a", "a")<0) which is "true && true"
which
is true so "a" and "a" are equivalent elements acording to your given
predicate (strcmp(x,y) < 0).

-- 
Dizzy
 




 17 Posts in Topic:
STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 02:28:00 
Re: STL set/map w.r.t const char*
"Jim Langston"   2008-05-06 02:38:48 
Re: STL set/map w.r.t const char*
Ian Collins <ian-news@  2008-05-06 21:45:25 
Re: STL set/map w.r.t const char*
dizzy <dizzy@[EMAIL PR  2008-05-06 12:48:27 
Re: STL set/map w.r.t const char*
Ian Collins <ian-news@  2008-05-06 21:58:20 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 03:34:07 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 03:34:45 
Re: STL set/map w.r.t const char*
Ian Collins <ian-news@  2008-05-06 23:02:48 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 03:38:11 
Re: STL set/map w.r.t const char*
Ian Collins <ian-news@  2008-05-06 23:04:47 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 04:01:55 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 04:21:30 
Re: STL set/map w.r.t const char*
dizzy <dizzy@[EMAIL PR  2008-05-06 15:48:36 
Re: STL set/map w.r.t const char*
James Kanze <james.kan  2008-05-06 05:28:54 
Re: STL set/map w.r.t const char*
terminator <farid.mehr  2008-05-06 07:25:33 
Re: STL set/map w.r.t const char*
S S <sarvesh.singh@[EM  2008-05-06 08:10:32 
Re: STL set/map w.r.t const char*
"Andrew Koenig"  2008-05-07 19:10:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 0:17:29 CDT 2008.