mfem: mfem::Array rule of 5 methods don't check if typename T is plain old data
The mfem::Array<T>
documentation states that typename T
must be plain old data. As of C++11, this condition is testable via the <type_traits>
header, e.g.:
#include <type_traits>
#include <iostream>
// std::is_pod<T> also works, but is deprecated as of C++20
if (std::is_trivial<T> && std::is_standard_layout<T>)
{
std::cout << "Type is plain old data" << std::endl;
}
else
{
std::cout << "Type is not plain old data" << std::endl;
}
A code snippet like this could be used to enforce the design contract declared in the documentation, assuming the project is amenable to the idea.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
This is being addressed in #2214. Let’s move any further discussion there.