-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace loop patterns with std algorithms under libs/ #950
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice modernization effort!
libs/ardour/location.cc
Outdated
while (i != positions.end () && *i < pos) { | ||
++i; | ||
} | ||
std::list<timepos_t>::iterator i = std::find_if( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::list<timepos_t>::iterator i = std::find_if( | |
auto i = std::find_if( |
everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you think it's OK now for you.
Personally I find this (std::copy_if, std::transform) syntax much less readable than loops. Just an And as discussed on IRC, I still think the preferred solution is not to batch replace code, but modernize it when actually working on a function (for bug fixes, or adding features). That may also provide opportunity to refactor it completely, and test; rather than just blindly replace it. |
0acef76
to
3a919b8
Compare
Changes to I still think batch updates are not the best way to move forward. There is no benefit to Ardour users, yet the slight risk of breaking things. Not all of modern C++ is suitable for a massive multi-threaded cross-platform realtime program (notably std::thread and std::chrono are a no-go, and other std APIs might have similar issues), not to mention quirks with various compilers (notably MSVC). With your C++ knowledge, I can imagine that your time might spent better fixing some bugs or adding actual features, rather than doing effective NO-OP commits. just my 2c. |
3a919b8
to
d091c3d
Compare
It brings more lines in many cases, but just reading the name of the algorithm function states what kind of loop it is and its meaning without having to read into its mechanics, which I have found useful when skimming through the code as a newcomer. However I understand that for anyone that is already familiar with the code and therefore only cares about the mechanics this may have the opposite effect. I myself don't even think this is ideal. The ranges API is far better IMO, but I realised later and it requires C++20/23 (something I don't advocate for now, the change to C++17 was already enough). Anyways, the verbosity of C++ can't be avoided for this functional style. That said, I'm not completely against reverting specifically all the
Sure, I won't start a similar effort under
Oops, reverted. BTW, shouldn't third-party libs be linked as a git submodule, instead of a plain copy of files? |
d091c3d
to
8a47e85
Compare
We do change the build-system, and we do not want to depend on any external hosts that we don't have control over (we've been bitten by that in the past). While we could mirror this repo on git.ardour.org and then use it as submodule, it is a lot more convenient to just run a script to copy the files. Besides we do in fact patch it: see https://github.com/Ardour/ardour/blob/master/tools/update_qm-vamp.sh#L33-L62 (because of MSVC). |
No description provided.