Re: expressing a certain algebraic statement in C++ STL

Discussion in 'C++' started by Michel Rosien, Apr 22, 2004.

  1. > > Hello mates
    > >
    > > How do you express the test "Does the value x belong in the set S ?"
    > > using the STL containers and algorithms ?

    >
    > Assuming you're talking about std::set, the test is
    >
    > S.find(x) != S.end();
    >



    To only determine whether a certain value is in a std::set I always use:

    S.count(x) > 0

    --Michel
    Michel Rosien, Apr 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Wahler
    Replies:
    1
    Views:
    383
    Razmig K
    Apr 1, 2004
  2. DennisNedry

    Algebraic Parser

    DennisNedry, Feb 2, 2005, in forum: C++
    Replies:
    6
    Views:
    875
    DennisNedry
    Feb 2, 2005
  3. steve
    Replies:
    3
    Views:
    263
    Paul Boddie
    Oct 23, 2006
  4. DavidM
    Replies:
    6
    Views:
    558
  5. Cristian
    Replies:
    9
    Views:
    570
    Victor Bazarov
    Aug 23, 2007
Loading...

Share This Page