Re: CTFE sort of tuples

2019-05-03 Thread Timon Gehr via Digitalmars-d-learn
On 02.05.19 09:28, Stefan Koch wrote: On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote: Hello, I have got this code:     [...] I want to sort array of tuples using "data" element in CTFE. But this code give me errors: [...] As I understand the function "sort" sometimes can't be run

Re: CTFE sort of tuples

2019-05-02 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote: Hello, I have got this code: [...] I want to sort array of tuples using "data" element in CTFE. But this code give me errors: [...] As I understand the function "sort" sometimes can't be run at CT because of reinterpreting cast.

CTFE sort of tuples

2019-05-01 Thread Andrey via Digitalmars-d-learn
Hello, I have got this code: alias Group = Tuple!(int[], "data", int, "key"); void main() { enum group = [ Group([1,2,3,4], 1), Group([5,3], 1), Group([4,5,4, 8, 9, 4], 1), Group([2,3,4], 1), ]; enum result = group.sort!"a.data < b.data"().array();