Thread: about intersection in the vector....any idea?

  1. #1
    Registered User
    Join Date
    Jan 2006

    about intersection in the vector....any idea?

    hi everyone, can someone please give me some idea on this kinda function?

    being thinking whole day and dont know what it means...

    // intersection of this set with another
    // Pre: a StringSet object
    // Post: returns a new StringSet which is the intersection
    // of this with otherset, ie. only the items common to both StringSets
    StringSet StringSet::set_intersection(StringSet otherset)


  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    (1)StringSet (2)StringSet(3)::(4)set_intersection((5)StringSet otherset)

    This is a function defined as member of a class.

    • (1) The function will return an object of type StringSet.
    • (2) The function is defined as a member of the StringSet class.
    • (3) The scope operator (:: ) serves to establish in which scope should this function be defined. On this case, it is the StringSet scope
    • (4) The function name.
    • (5) It's parameter. It accepts as parameter a StringSet object that it will call otherset.

    To better understand how to define function members of classes, read about classes on some good tutorial like:
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Jan 2006
    yap, thank you for that. but i mean code idea not definition sample... thank you

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    What's to think about?
    Do you know what a set is - look it up at mathworld.

    Elements which appear in both are the intersection, so just a loop searching for each one.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. project idea ???
    By gemini_shooter in forum C Programming
    Replies: 2
    Last Post: 06-09-2005, 09:56 AM
  2. Have an idea?
    By B0bDole in forum Projects and Job Recruitment
    Replies: 46
    Last Post: 01-13-2005, 03:25 PM
  3. A little problem about an idea, help please
    By louis_mine in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2004, 09:52 PM
  4. totally screwed up idea
    By iain in forum A Brief History of
    Replies: 9
    Last Post: 08-17-2001, 12:09 PM