Add hacks due to remaining issues in port
This commit is contained in:
parent
5f7d2716bd
commit
60490f04de
4 changed files with 36 additions and 1 deletions
|
@ -105,6 +105,10 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
|
||||||
|
|
||||||
bool uniform = false;
|
bool uniform = false;
|
||||||
|
|
||||||
|
/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/
|
||||||
|
// ALSO REQUIRES c++17 currently. roll-back required to c++11
|
||||||
|
if constexpr (is_inequality_comparable<T>::value)
|
||||||
|
{
|
||||||
if (L.size() > 1 && contiguous<T>())
|
if (L.size() > 1 && contiguous<T>())
|
||||||
{
|
{
|
||||||
uniform = true;
|
uniform = true;
|
||||||
|
@ -179,6 +183,7 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
|
||||||
os << nl << token::END_LIST << nl;
|
os << nl << token::END_LIST << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (os.format() == IOstream::BINARY)
|
else if (os.format() == IOstream::BINARY)
|
||||||
{
|
{
|
||||||
os << nl << L.size() << nl;
|
os << nl << L.size() << nl;
|
||||||
|
|
|
@ -54,6 +54,10 @@ void Foam::UListProxy<T>::writeFirstElement
|
||||||
const char* data
|
const char* data
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/
|
||||||
|
// ALSO REQUIRES c++17 currently. roll-back required to c++11
|
||||||
|
if constexpr (is_inequality_comparable<T>::value)
|
||||||
|
{
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
const T* dataT = reinterpret_cast<const T*>(data);
|
const T* dataT = reinterpret_cast<const T*>(data);
|
||||||
|
@ -66,6 +70,7 @@ void Foam::UListProxy<T>::writeFirstElement
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (OPENFOAM >= 2206)
|
#if (OPENFOAM >= 2206)
|
||||||
|
@ -160,6 +165,10 @@ Foam::UListProxy<T>::determineUniformity() const
|
||||||
{
|
{
|
||||||
uListProxyBase::uniformity u = uListProxyBase::UNIFORM;
|
uListProxyBase::uniformity u = uListProxyBase::UNIFORM;
|
||||||
|
|
||||||
|
/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/
|
||||||
|
// ALSO REQUIRES c++17 currently. roll-back required to c++11
|
||||||
|
if constexpr (is_inequality_comparable<T>::value)
|
||||||
|
{
|
||||||
// Skip comparison of the first element with itself
|
// Skip comparison of the first element with itself
|
||||||
for (label i = 1; i < nElems; i++)
|
for (label i = 1; i < nElems; i++)
|
||||||
{
|
{
|
||||||
|
@ -169,6 +178,7 @@ Foam::UListProxy<T>::determineUniformity() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,25 @@ struct is_vectorspace
|
||||||
std::true_type
|
std::true_type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/
|
||||||
|
|
||||||
|
// IS_INEQUALITY_COMPARABLE
|
||||||
|
// primary template
|
||||||
|
template<typename T, typename = Void_T<>>
|
||||||
|
struct is_inequality_comparable : std::false_type {};
|
||||||
|
|
||||||
|
//partial specialization, maybe SFINAE'd away
|
||||||
|
template<typename T>
|
||||||
|
struct is_inequality_comparable
|
||||||
|
<
|
||||||
|
T,
|
||||||
|
Void_T<decltype(std::declval<T>() != std::declval<T>())>
|
||||||
|
>
|
||||||
|
:
|
||||||
|
std::true_type
|
||||||
|
{};
|
||||||
|
|
||||||
|
/*<<<<<<<<<<<<<<<<<<<<< TODO port: hacks to circumvent errors in UListIO.C *************/
|
||||||
|
|
||||||
// TODO: This should probably go somewhere else. Toward VectorSpace ecosystem?
|
// TODO: This should probably go somewhere else. Toward VectorSpace ecosystem?
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -5,7 +5,8 @@ c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual
|
||||||
# Suppress some warnings for flex++ and CGAL
|
# Suppress some warnings for flex++ and CGAL
|
||||||
c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
|
c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
|
||||||
|
|
||||||
CC = g++ -std=c++11 -m64
|
# TODO port: return to c++11 again
|
||||||
|
CC = g++ -std=c++17 -m64
|
||||||
|
|
||||||
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||||
|
|
||||||
|
|
Reference in a new issue