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: nine . fierce . ballads
Subject: Re: Abstract Grob property storage into Mutable_properties. (issue 561640043 by address@hidden)
Date: Mon, 13 Apr 2020 10:15:19 -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 {
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.

https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode54
lily/include/mutable-properties.hh:54: Iterator iter() const {
Does const serve a purpose here?  The iterator doesn't carry through
with any kind of enforcement.  The same question applies to
try_retrieve() and to_alist().

https://codereview.appspot.com/561640043/diff/565900043/lily/include/mutable-properties.hh#newcode60
lily/include/mutable-properties.hh:60: void swap(Mutable_properties*);
Please: void swap(Mutable_properties&) like everything in the STL.

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



reply via email to

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