is it possible to sort a float range ?

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 23 22:46:28 UTC 2021


On 6/23/21 6:30 PM, Jordan Wilson wrote:
> On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote:
>> Please, look for the line marked +++
>>
>> This is a structure with a public property returning a (still 
>> unsorted) range built on-the-fly from already-set properties, a basic 
>> range from a to z with n step where some specific values can be added 
>> in-between. The range is a float which I am currently using for 
>> currency (horrible) and later plan to move it to decimal 10 or the like.
>>
>> [...]
> 
> ```sort``` returns a ```SortedRange```, and I believe you wish to return 
> a float. So you can do either ```return lnumRange.sort!(...).array;```, 
> or you can do ```lnumRange.sort!(...); return lnumRange```.

Use the `release` method:

```d
return lnumRange.sort!(...).release;
```

-Steve


More information about the Digitalmars-d-learn mailing list