Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How to add a struct to a U++ container?
How to add a struct to a U++ container? [message #38599] Thu, 27 December 2012 00:21 Go to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
I'm trying something like this:

struct Person {
String n;
int a;

Person(String name, int age) {
n=name; a=age;
}
};

Then I need to add persons like this:

VectorMap<int, Person> m;
m.Add(1, Person("John", 30));

But it gives me compile error. Any ideas?
Re: How to add a struct to a U++ container? [message #38600 is a reply to message #38599] Thu, 27 December 2012 00:27 Go to previous message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Found my answer here: http://www.ultimatepp.org/forum/index.php?t=msg&goto=230 31&&srch=add+struct+to+container#msg_23031

It should be Moveable or use ArrayMap.

Embarassed

Sorry for this thread. I should have searched it before. You can delete it if you want.
Previous Topic: Need help with new project
Next Topic: How to add a Bazaar package to my package?
Goto Forum:
  


Current Time: Fri Apr 19 12:29:48 CEST 2024

Total time taken to generate the page: 0.03549 seconds