Home » Community » Newbie corner » VectorMap picks two vectors
VectorMap picks two vectors [message #38153] |
Mon, 03 December 2012 02:54  |
nejnadusho
Messages: 60 Registered: October 2012
|
Member |
|
|
Hi,
I can't figure out how to pick two vectors into a VectorMap.
I am even not sure I am expressing myself correctly.
Thus,
#include <Core/Core.h>
#include <iostream>
using namespace std;
using namespace Upp;
CONSOLE_APP_MAIN
{
VectorMap<int , String> myMap;
Vector<String> v1;
Vector<int> v2;
for (int i = 0; i < 10; ++i){
v1.Add("String " + AsString(i));
v2.Add(new Integer(i));
}
for (int i = 0; i < 10; ++i){
string a = v1[i];
cout << a << endl;
cout << v2[i] << endl;
}
myMap.AddPick(&v2, &v1);
}
I hope this is clear.
How can I push these two vectors into the VectorMap?
Thank you.
Best,
Georgi
|
|
|
|
|
|
|
Re: VectorMap picks two vectors [message #38161 is a reply to message #38157] |
Mon, 03 December 2012 07:18   |
|
Lance wrote on Mon, 03 December 2012 06:30 | correct me if there is a member function do what you intended in a single call
| This can be done in single call, but only in constructor: Vector<String> v1;
Vector<int> v2;
for (int i = 0; i < 10; ++i){
v1.Add("String " + AsString(i));
v2.Add(i);
}
VectorMap<int, String> myMap(v2,v1);
StdLogSetup(LOG_CERR);
DUMP(v1.IsPicked());
DUMP(v2.IsPicked());
DUMPM(myMap);
Best regards,
Honza
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:44:02 CEST 2025
Total time taken to generate the page: 0.00782 seconds
|