31
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include <iostream>
|
|
18 |
#include <set>
|
|
19 |
#include <vector>
|
|
20 |
|
|
21 |
template<class T>
|
|
22 |
inline void printElements(const T& coll, const char* msg = "")
|
|
23 |
{
|
|
24 |
typename T::const_iterator it;
|
|
25 |
std::cout << msg;
|
|
26 |
for(it = coll.begin(); it != coll.end(); ++it) {
|
|
27 |
std::cout << *it << ' ';
|
|
28 |
}
|
|
29 |
std::cout << std:: endl;
|
|
30 |
}
|
|
31 |
|
|
32 |
int main(int /* argc */, char** /* argv */)
|
|
33 |
{
|
|
34 |
std::set<int> set1, set2;
|
|
35 |
std::vector<int> aVector;
|
|
36 |
|
|
37 |
aVector.push_back(1);
|
|
38 |
aVector.push_back(1);
|
|
39 |
|
|
40 |
set1.insert(aVector.begin(), aVector.end());
|
|
41 |
|
|
42 |
set2.insert(1);
|
|
43 |
set2.insert(1);
|
|
44 |
|
|
45 |
printElements(aVector, "vector: ");
|
|
46 |
printElements(set1, "set1 : ");
|
|
47 |
printElements(set2, "set2 : ");
|
|
48 |
|
|
49 |
return 0;
|
|
50 |
}
|
|
51 |
# if 0
|
|
52 |
# include <iostream>
|
|
53 |
main()
|
|
54 |
{
|
|
55 |
// std::stringstream tstr;
|
|
56 |
std::cout<<"hello world\n";
|
|
57 |
}
|
|
58 |
# endif
|