You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] Constrain TElement to trivially copyable types (C# where TElement : struct) #132
template <typename TElement> classFileArrayMemory<TElement> final : public IArrayMemory<TElement>
//where TElement : struct
Problem:
The C# constraint where TElement : struct was left as a comment during translation, so the C++ templates accept any TElement. FileArrayMemory, DirectMemoryAsArrayMemoryAdapter and ArrayMemory copy elements as raw bytes, which is only valid for trivially copyable types.
Suggestion:
Express the constraint in C++ (C++20 requires std::is_trivially_copyable_v<TElement> or a static_assert) for FileArrayMemory and DirectMemoryAsArrayMemoryAdapter (C# has the same constraint on both), and add a compile-time test.
Activity
Convert remaining commented-out C++ code to issues #132, #133