Merge branch 'master' into jwi-bcc64xsingletonwarning
[ACE_TAO.git] / ACE / examples / Misc / test_set.cpp
bloba336b09336008115bbf561bdb5999b797dbe567f
1 #include "ace/OS_main.h"
2 #include "ace/Containers.h"
3 #include "ace/Log_Msg.h"
5 int
6 ACE_TMAIN (int, ACE_TCHAR *[])
8 ACE_Unbounded_Set<int> s1;
10 ACE_ASSERT (s1.size () == 0);
11 s1.insert_tail (10);
12 s1.insert_tail (20);
13 ACE_ASSERT (s1.size () == 2);
15 ACE_Unbounded_Set<int> s2 (s1);
16 ACE_ASSERT (s2.size () == 2);
18 ACE_Unbounded_Set<int> s3;
19 ACE_ASSERT (s3.size () == 0);
21 s3 = s2;
22 ACE_ASSERT (s3.size () == s2.size ());
24 ACE_Unbounded_Set<int> s4 (s3);
25 ACE_ASSERT (s4.size () == 2);
27 int *ip = 0;
29 ACE_DEBUG ((LM_DEBUG, "dumping s1\n"));
30 for (ACE_Unbounded_Set_Iterator<int> iter1 (s1);
31 iter1.next (ip) != 0;
32 iter1.advance ())
33 ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
35 ACE_DEBUG ((LM_DEBUG, "dumping s2\n"));
36 for (ACE_Unbounded_Set_Iterator<int> iter2 (s2);
37 iter2.next (ip) != 0;
38 iter2.advance ())
39 ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
41 ACE_DEBUG ((LM_DEBUG, "dumping s3\n"));
42 for (ACE_Unbounded_Set_Iterator<int> iter3 (s3);
43 iter3.next (ip) != 0;
44 iter3.advance ())
45 ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
47 ACE_DEBUG ((LM_DEBUG, "dumping s4\n"));
48 for (ACE_Unbounded_Set_Iterator<int> iter4 (s4);
49 iter4.next (ip) != 0;
50 iter4.advance ())
51 ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
53 return 0;