OpenFOAM-plus issueshttps://develop.openfoam.com/Development/OpenFOAM-plus/-/issues2018-03-19T07:19:47Zhttps://develop.openfoam.com/Development/OpenFOAM-plus/-/issues/769change contiguous to a class2018-03-19T07:19:47ZMark Olesenchange contiguous to a classCurrently implemented as a number of global functions, but a templated class function would be more flexible.
Eg,
//- Default definition: (integral | floating-point) are contiguous
template<class T>
struct contiguous
:
...Currently implemented as a number of global functions, but a templated class function would be more flexible.
Eg,
//- Default definition: (integral | floating-point) are contiguous
template<class T>
struct contiguous
:
std::integral_constant
<
bool,
std::is_integral<T>::value || std::is_floating_point<T>::value
>
{};
//- FixedList of (integral | floating-point) is contiguous
template<class T, unsigned N>
struct contiguous<FixedList<T, N>>
:
std::integral_constant
<
bool,
std::is_integral<T>::value || std::is_floating_point<T>::value
>
{};
These definitions work for any size FixedList and thus eliminate most of contiguous.H.
Template specializations for the function definition aren't really possible.
Pros:
- usable in constexpr, at compile-time and static_assert
Cons:
- user code that is currently overloading `contiguous` needs to specify it different.
template<> inline bool contiguous<someType>() { return true; }
template<> struct contiguous<someType> : std::true_type {};Mark OlesenMark Olesen