Home » Community » Newbie corner » Any tuple examples?
Any tuple examples? [message #29772] |
Tue, 16 November 2010 04:19 |
alendar
Messages: 47 Registered: January 2010 Location: Idaho, USA
|
Member |
|
|
I'm trying to use the Tuple2 object.
Is there any way to assign a set to a tuple?
For example:
String tagttl = "Source";
String tagval = "Vinyl";
Tuple2<String, String> arr;
arr = new Tuple2(tagttl, tagval);
Stumped.
Thanks,
Jeff
cd7651feeb698f6ac6cec1f6deda5e5b
|
|
|
Re: Any tuple examples? [message #29779 is a reply to message #29772] |
Tue, 16 November 2010 10:08 |
|
Hi Jeff
This should be what you are looking for:#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN{
String s1="Hello";
String s2="world";
Tuple2<String,String> a=MakeTuple(s1,s2);
// or directly initialize:
Tuple2<String,int> b={"Hi",5};
}
MakeTuple() takes 2,3 or 4 arguments of any type, producing corresponding Tuple.
Best regards,
Honza
|
|
|
|
Goto Forum:
Current Time: Sat May 11 17:35:56 CEST 2024
Total time taken to generate the page: 0.02343 seconds
|