U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » VectorMap inside VectorMap
Re: VectorMap inside VectorMap [message #19934 is a reply to message #19932] Tue, 03 February 2009 18:12 Go to previous messageGo to previous message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
White_Owl wrote on Tue, 03 February 2009 17:24

I thought for "pick" you have to use GetAddPick() method?

The methods with "pick" in the name, pick the argument that you pass the method. But in your first example you use the assignment operator which "picks" the value from the right to the left variable.

I think you want something like this:
#include <Core/Core.h>

using namespace Upp;

class mycontainer: Moveable<mycontainer> {
public:
	VectorMap<String, String> data;
};

VectorMap<String, mycontainer> vm;

CONSOLE_APP_MAIN
{
	mycontainer &ca = vm.GetAdd("First");
	ca.data.FindPut("first-first", "aa");
	ca.data.FindPut("first-second", "bb");
	
	mycontainer &cb = vm.GetAdd("First");
	cb.data.FindPut("first-first", "cc"); // run-time error
	cb.data.FindPut("first-second", "dd");
}


Like that you don't call the assignment operator but you just use the reference that get's returned from GetAdd. So there is no picking.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Quick bi-array
Next Topic: Core package build flags
Goto Forum:
  


Current Time: Sun Apr 26 11:56:38 GMT+2 2026

Total time taken to generate the page: 0.00523 seconds