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 » U++ Library support » U++ Core » Returning Tuple that contains Vector is not possible
Returning Tuple that contains Vector is not possible [message #49786] Sun, 06 May 2018 01:07 Go to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

I found that returning vector in tuple is impossible on compilation level. Here is an exemplary code that doesn't compile:
Tuple<bool, Vector<String>> LoadTopics(const String& grouppath) {
    	Vector<String> topics;
	bool renamed = false;

        // ...

        return { renamed, pick(topics) };
}


I believe the same code done using c++ standard library should compile normally - https://stackoverflow.com/questions/39514150/function-return -a-tuple-made-of-vectors. But, I need to check to be 100% sure.

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Sun, 06 May 2018 01:11]

Report message to a moderator

Re: Returning Tuple that contains Vector is not possible [message #49798 is a reply to message #49786] Tue, 08 May 2018 12:40 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Klugier wrote on Sun, 06 May 2018 01:07
Hello,

I found that returning vector in tuple is impossible on compilation level. Here is an exemplary code that doesn't compile:
Tuple<bool, Vector<String>> LoadTopics(const String& grouppath) {
    	Vector<String> topics;
	bool renamed = false;

        // ...

        return { renamed, pick(topics) };
}


I believe the same code done using c++ standard library should compile normally - https://stackoverflow.com/questions/39514150/function-return -a-tuple-made-of-vectors. But, I need to check to be 100% sure.

Sincerely,
Klugier


That is correct. Tuple, for now, is meant for "full copy" types.

Mirek
Previous Topic: simple bug? passing String::GetVoid() to StringStream
Next Topic: [BUG]TcpSocket::Connect return always true
Goto Forum:
  


Current Time: Thu Mar 28 12:13:07 CET 2024

Total time taken to generate the page: 0.01177 seconds