cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
return multiple pointers
return multiple pointers
Dec 1, 2016 at 1:37pm UTC
mohmdasher
(1)
Hi, im trying to pass and return two pointers or effectively two different types of arrays from one function to another. I went through tuples but they can pass multiple variables but not arrays. Could someone please help me with a simple example.
Thank You
Dec 1, 2016 at 2:13pm UTC
MikeyBoy
(5631)
Am I missing something? Why can't you just pass them both as two arguments to the function?
Dec 1, 2016 at 10:33pm UTC
mbozzi
(3944)
Multiple value return is awkward in C++:
Ex:
T a; U b; std::tie(a, b) = make_tuple(T{}, U{});
Which isn't too terrible, unless you want a and b to be const, which is a common thing.
Not even the immediately-invoked lambda expression trick can really save us now -- this gets ugly, fast.
Can you show some code? What are you actually trying to do? There's probably a better way.
Last edited on
Dec 1, 2016 at 10:35pm UTC
Topic archived. No new replies allowed.