On 8/3/17 4:30 AM, Olivier FAURE wrote:
I understand the general concept you're describing, but what exactly are
tail modifiers? It's the first time I see this name, and my google-fu
gives me nothing.
tail modifiers are modifiers that only apply to the "tail" of the type.
For example
On Wednesday, 2 August 2017 at 18:06:03 UTC, H. S. Teoh wrote:
On Wed, Aug 02, 2017 at 01:15:44PM -0400, Steven Schveighoffer
via Digitalmars-d-learn wrote: [...]
The real answer is to have tail modifiers for structs, so you
can do the same thing an array does. Note that if Result is an
array,
On Wed, Aug 02, 2017 at 11:06:03AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> auto byPair(AA)(inout(AA) aa)
> {
> alias Modifiers = std.traits.getModifiers!AA;
> struct Result {
> std.traits.ApplyModifiers!(Slot*,
On 8/2/17 2:06 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Wed, Aug 02, 2017 at 01:15:44PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[...]
It's not currently legal, you can't have inout members of a struct.
This could be added, but it still wouldn't work, because you
On Wed, Aug 02, 2017 at 01:15:44PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[...]
> It's not currently legal, you can't have inout members of a struct.
> This could be added, but it still wouldn't work, because you can't
> "strip off" the inout part upon return.
>
> The real
On 8/2/17 11:52 AM, H. S. Teoh via Digitalmars-d-learn wrote:
On Wed, Aug 02, 2017 at 08:20:23AM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 8/1/17 7:44 PM, H. S. Teoh via Digitalmars-d-learn wrote:
[...]
You can iterate a const AA, but if you want to iterate a non-const
On Wed, Aug 02, 2017 at 08:20:23AM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 8/1/17 7:44 PM, H. S. Teoh via Digitalmars-d-learn wrote:
[...]
> You can iterate a const AA, but if you want to iterate a non-const AA,
> you need a different type.
>
> For instance, if your AA is
On 8/1/17 7:44 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 01, 2017 at 07:31:41PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 8/1/17 7:15 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 01, 2017 at 07:09:45PM -0400, Steven Schveighoffer via
On Tue, Aug 01, 2017 at 07:31:41PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 8/1/17 7:15 PM, H. S. Teoh via Digitalmars-d-learn wrote:
> > On Tue, Aug 01, 2017 at 07:09:45PM -0400, Steven Schveighoffer via
> > Digitalmars-d-learn wrote:
> > > If this were a true
On 8/1/17 7:15 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 01, 2017 at 07:09:45PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
If this were a true implementation without the opaqueness, it would
not work properly.
[...]
Actually, a proper implementation would
On Tue, Aug 01, 2017 at 07:09:45PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 8/1/17 6:50 PM, H. S. Teoh via Digitalmars-d-learn wrote:
[...]
> > Actually, there's nothing about the implementation of both
> > byKeyValue (the underlying implementation in druntime) and byPair
On 8/1/17 6:50 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 01, 2017 at 10:04:18AM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 7/30/17 12:19 AM, Matthew Gamble wrote:
[...]
import std.array;
import std.algorithm;
class A
{
this() { aa = ["a":1, "b" : 2,
On Tue, Aug 01, 2017 at 10:04:18AM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 7/30/17 12:19 AM, Matthew Gamble wrote:
[...]
> > import std.array;
> > import std.algorithm;
> >
> > class A
> > {
> > this() { aa = ["a":1, "b" : 2, "c" : 3]; }
> > auto pairs()
On 7/30/17 12:19 AM, Matthew Gamble wrote:
I have a class member function from which I'm trying to return a sorted
array of key, value tuples stored in an associative array as a private
member. The member function should be able to be marked const to prevent
the AA from being modified. I have
On 07/29/2017 10:15 PM, Matthew Gamble wrote:
>> I think it should work. I think a cast to unqualified is a safe
>> workaround in this case:
>>
>> auto pairs() @property const { return
>> (cast(int[string])aa).byPair.array.sort().release; }
As your question reveals, casting away const is
On Sunday, 30 July 2017 at 04:36:19 UTC, Ali Çehreli wrote:
On 07/29/2017 09:19 PM, Matthew Gamble wrote:
I have a class member function from which I'm trying to return
a sorted
array of key, value tuples stored in an associative array as a
private
member. The member function should be able to
On 07/29/2017 09:19 PM, Matthew Gamble wrote:
I have a class member function from which I'm trying to return a sorted
array of key, value tuples stored in an associative array as a private
member. The member function should be able to be marked const to prevent
the AA from being modified. I have
17 matches
Mail list logo