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 » Any tuple examples?
Any tuple examples? [message #29772] Tue, 16 November 2010 04:19 Go to next message
alendar is currently offline  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 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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
Re: Any tuple examples? [message #30329 is a reply to message #29779] Fri, 24 December 2010 23:15 Go to previous message
alendar is currently offline  alendar
Messages: 47
Registered: January 2010
Location: Idaho, USA
Member
Thanks, Honza.

I ended up using a ValueArray, but I'll switch it to Tuple2.


cd7651feeb698f6ac6cec1f6deda5e5b

[Updated on: Fri, 24 December 2010 23:17]

Report message to a moderator

Previous Topic: Fatal error kills app in try/catch - - Why?
Next Topic: FullScreen: why does not work?
Goto Forum:
  


Current Time: Sun Apr 28 05:52:50 CEST 2024

Total time taken to generate the page: 0.08906 seconds