lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abstract Grob property storage into Mutable_properties. (issue 56164


From: hanwenn
Subject: Re: Abstract Grob property storage into Mutable_properties. (issue 561640043 by address@hidden)
Date: Mon, 13 Apr 2020 10:22:52 -0700

https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh
File lily/include/mutable-properties.hh (right):

https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode31
lily/include/mutable-properties.hh:31: class Iterator {
On 2020/04/13 17:15:19, Dan Eble wrote:
> This is useful, but instead of choosing your own method names, why not
give it
> an interface consistent with standard iterators (where the semantics
match)?
> 
> https://en.cppreference.com/w/cpp/named_req/InputIterator
> 
> I'd leave out the key() and value() methods and let it dealing with
just a
> generic list of SCM values.
> 
> If you implemented enough of the iterator interface, and a class to
wrap the raw
> SCM list into an object addressable with begin() and end(), I think
you would be
> able to write range-for statements something like this:
> 
> for (SCM assoc : ly_list(my_alist))
>   {
>     SCM key = scm_car(assoc);
>     SCM val = scm_cdr(assoc);
>     ...;
>   }
> 
> If you're not interested in doing this, I might try it myself.

By structuring it like this, you enforce the implementation to store the
key/value as SCM cells, which is exactly what we want to get away from.

https://codereview.appspot.com/561640043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]