File: test.cpp

package info (click to toggle)
stlport4.6 4.6.2-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 7,056 kB
  • ctags: 16,390
  • sloc: ansic: 46,190; cpp: 18,805; sh: 266; asm: 93; perl: 58; makefile: 10
file content (42 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
           #include <iostream>
           #include <set>
           #include <vector>

           template<class T>
           inline void printElements(const T& coll, const char* msg = "")
           {
           typename T::const_iterator it;
           std::cout << msg;
           for(it = coll.begin(); it != coll.end(); ++it) {
           std::cout << *it << ' ';
           }
           std::cout << std:: endl;
           }

           int main(int /* argc */, char** /* argv */)
           {
           std::set<int> set1, set2;
           std::vector<int> aVector;

           aVector.push_back(1);
           aVector.push_back(1);

           set1.insert(aVector.begin(), aVector.end());

           set2.insert(1);
           set2.insert(1);

           printElements(aVector, "vector: ");
           printElements(set1, "set1 : ");
           printElements(set2, "set2 : ");

           return 0;
           }
# if 0
# include <iostream>
main() 
{
  // std::stringstream tstr;
  std::cout<<"hello world\n";
}
# endif