Thread: Union 2 arrays

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    17

    Union 2 arrays

    Does anyone know any code to union 2 sets?

    I have a prototype in my header file of:
    Code:
    IntegerSet& unionSet( IntegerSet& otherSet );
    I want to union array c and b and am calling the function by:
    Code:
    c.unionSet( b );
    What code could I use to combine into 1 array in the .cpp file, returning a reference to the array?

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    assuming it's an std::set, can't you use operator += ?

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Or maybe the STL set_union function might be of use depending on how the storage of the data elements is implemented?
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. union of two arrays
    By chaitanya in forum C Programming
    Replies: 2
    Last Post: 09-12-2004, 05:53 AM
  4. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 09:24 PM
  5. Sorting a Union
    By andy in forum C Programming
    Replies: 4
    Last Post: 11-21-2001, 10:12 AM