On 04/08/2016 01:53 PM, WhatMeWorry wrote:

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 is a variable. Did you mean

alias Collision = Tuple!(GLboolean, Direction, vec2);



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

That won't work because you should have a type instead of Collision (a variable).

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.

And yes, functions can return tuples: :)

import std.typecons;

struct S {
    int i;
}

Tuple!(int, S) foo() {
    return tuple(42, S(43));
}

void main() {
    auto a = foo();
}

Ali


Reply via email to