Skip to content

Resolve remaining C++20 TODOs#8326

Merged
rubiefawn merged 3 commits intoLMMS:masterfrom
rubiefawn:cpp20-todos
Mar 23, 2026
Merged

Resolve remaining C++20 TODOs#8326
rubiefawn merged 3 commits intoLMMS:masterfrom
rubiefawn:cpp20-todos

Conversation

@rubiefawn
Copy link
Copy Markdown
Contributor

Resolves the following TODO comments:

  • include/ArrayVector.h:309: TODO C++20: Use std::construct_at
  • include/ArrayVector.h:365: TODO C++20: Replace with operator<=>
  • include/ArrayVector.h:378: TODO C++20: Remove
  • include/Flags.h:71: TODO C++20: = default
  • include/Flags.h:72: TODO C++20: Remove

The TODO in include/lmms_math.h:326 TODO C++20: use std::formatted_size has some compiler support and is handled separately in #8321.

There are likely many other places in the codebase that could benefit from C++20 features. This PR is focused on resolving explicit TODO comments only.

With a single exception, which is already handled by LMMS#8321
@messmerd
Copy link
Copy Markdown
Member

In ArrayVector.h, you can also remove the entire detail namespace and then fix the template parameters of some methods like this:

-	template<typename It, std::enable_if_t<detail::is_input_iterator_v<It>, int> = 0>
+	template<std::input_iterator It>

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
@messmerd
Copy link
Copy Markdown
Member

Maybe you could also add a note about std::inplace_vector to the comment before the ArrayVector class:

/**
 * A container that stores up to a maximum of `N` elements of type `T` directly
 * within itself, rather than separately on the heap. Useful when a dynamically
 * resizeable container is needed for use in real-time code. Can be thought of
 * as a hybrid between `std::array` and `std::vector`. The interface follows
 * that of `std::vector` - see standard C++ documentation.
+ *
+ * TODO C++26: Use std::inplace_vector instead
 */

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
@rubiefawn rubiefawn merged commit 1155590 into LMMS:master Mar 23, 2026
11 checks passed
@rubiefawn rubiefawn deleted the cpp20-todos branch March 23, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants