lilypond-devel
[Top][All Lists]
Advanced

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

Re: Issue 4365: Add ly_is_smob<T>(S) to check if S is a smob of type T.


From: dak
Subject: Re: Issue 4365: Add ly_is_smob<T>(S) to check if S is a smob of type T. (issue 236850043 by address@hidden)
Date: Sat, 02 May 2015 08:25:09 +0000


https://codereview.appspot.com/236850043/diff/1/lily/include/smobs.hh
File lily/include/smobs.hh (right):

https://codereview.appspot.com/236850043/diff/1/lily/include/smobs.hh#newcode235
lily/include/smobs.hh:235: template <class T>
Nope.  dynamic_cast is non-trivial operation that cannot be optimized
away at compile time for almost any use.  Calling it for every instance
of the rather ubiquitous is_smob query (ubiquitous enough that I made it
an operation separate from unsmob and checked that the generated code
was nicer) is excessive.

And all that for avoiding less of a dozen instances of an open-coded
dynamic_cast with reasonably clear intent?  No.

Creating a separate function or template for that is one thing.  Forcing
everything else through it another.

https://codereview.appspot.com/236850043/



reply via email to

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