function returning a tuple

WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 8 13:53:01 PDT 2016


This might be a very simple fix, but I've been fighting this for 
more hours than I care to admit to.


std.typecons says "Tuple of values, for example Tuple!(int, 
string) is a record that stores an int and a string. Tuple can be 
used to bundle values together, notably when returning multiple 
values from a function."


But when I try this in practice with

// typedef std::tuple<GLboolean, Direction, glm::vec2> Collision; 
// porting C++ to
Tuple!(GLboolean, Direction, vec2) Collision;


Collision CheckCollision(BallObject one, GameObject two) // AABB 
- Circle collision
{


DMD 2.071.0, keeps returning at the function signature:
Error: functions cannot return a tuple

I've also tried,
alias Collision = AliasSeq!(GLboolean, Direction, vec2);
but same error.

Am I doing anything stupid here?
thanks.








More information about the Digitalmars-d-learn mailing list