April 01, 2014 Re: How to foreach over a DList? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On Tuesday, 1 April 2014 at 13:54:00 UTC, monarch_dodra wrote:
> In contrast, if you *pass* "1" to the DList, you lose that info, and the DList will complain that you are trying to assign an int to a ubyte.
EDIT: The issue is actually one of template constraint, but it's
essentially equivalent. Without context you can't assign an int
to a ubyte.
|
April 01, 2014 Re: How to foreach over a DList? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On Tue, Apr 01, 2014 at 06:04:48AM +0000, monarch_dodra wrote: > On Tuesday, 1 April 2014 at 04:43:44 UTC, H. S. Teoh wrote: > >On Mon, Mar 31, 2014 at 09:55:01PM +0000, monarch_dodra wrote: > >>On Monday, 31 March 2014 at 21:41:16 UTC, H. S. Teoh wrote: > >>>Argh, why is opSlice non-const? :-( Please file a bug. > >> > >>If opSlice was const, then you'd get a const slice, with const reference. You wouldn't even be able to iterate on it. > >[...] > > > >Um... wat? > > I'm pointing out the fix is not as trivial as slapping "const" onto the signature. It requires a very real investment in terms of development. [...] Well, yes... I don't expect just adding 'const' to an existing function is going to magically make it work with const types. :-P Though I suppose the way I said it was ambiguous. My bad. T -- Those who don't understand Unix are condemned to reinvent it, poorly. |
April 01, 2014 Re: How to foreach over a DList? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On Tuesday, 1 April 2014 at 13:55:05 UTC, monarch_dodra wrote:
> On Tuesday, 1 April 2014 at 13:54:00 UTC, monarch_dodra wrote:
>> In contrast, if you *pass* "1" to the DList, you lose that info, and the DList will complain that you are trying to assign an int to a ubyte.
>
> EDIT: The issue is actually one of template constraint, but it's
> essentially equivalent. Without context you can't assign an int
> to a ubyte.
I thought that maybe VRP might work here (as you detailed in your other post), as it works elsewhere. Is is possible to extend VRP to cover this situation?
|
April 01, 2014 Re: How to foreach over a DList? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Tuesday, 1 April 2014 at 15:16:41 UTC, Meta wrote:
> On Tuesday, 1 April 2014 at 13:55:05 UTC, monarch_dodra wrote:
>> On Tuesday, 1 April 2014 at 13:54:00 UTC, monarch_dodra wrote:
>>> In contrast, if you *pass* "1" to the DList, you lose that info, and the DList will complain that you are trying to assign an int to a ubyte.
>>
>> EDIT: The issue is actually one of template constraint, but it's
>> essentially equivalent. Without context you can't assign an int
>> to a ubyte.
>
> I thought that maybe VRP might work here (as you detailed in your other post), as it works elsewhere. Is is possible to extend VRP to cover this situation?
*Maybe*, but it would require getting rid of the constraints. However, those template constraints are necessary to resolve the overloads to begin with ("insertBack(value)" vs "insertBack(range)"). So VRP wouldn't even get a chance to trigger :/
|
April 01, 2014 Re: How to foreach over a DList? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | Just for reference, this is the compiling code: https://gist.github.com/Binero/f30e56351baf05f1a2ec |
Copyright © 1999-2021 by the D Language Foundation