diff --git a/src/foam/containers/Lists/UList/UListIO.C b/src/foam/containers/Lists/UList/UListIO.C index 16d3272ad..e2b68ac51 100644 --- a/src/foam/containers/Lists/UList/UListIO.C +++ b/src/foam/containers/Lists/UList/UListIO.C @@ -105,6 +105,10 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList& L) 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::value) + { if (L.size() > 1 && contiguous()) { uniform = true; @@ -178,6 +182,7 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList& L) // Write end delimiter os << nl << token::END_LIST << nl; } + } } else if (os.format() == IOstream::BINARY) { diff --git a/src/foam/db/IOstreams/SliceStreams/UListProxy.C b/src/foam/db/IOstreams/SliceStreams/UListProxy.C index 26832de95..e6c1b1d3e 100644 --- a/src/foam/db/IOstreams/SliceStreams/UListProxy.C +++ b/src/foam/db/IOstreams/SliceStreams/UListProxy.C @@ -54,6 +54,10 @@ void Foam::UListProxy::writeFirstElement const char* data ) 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::value) + { if (data) { const T* dataT = reinterpret_cast(data); @@ -65,6 +69,7 @@ void Foam::UListProxy::writeFirstElement << "Given data pointer is nullptr." << abort(FatalError); } + } } @@ -160,6 +165,10 @@ Foam::UListProxy::determineUniformity() const { 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::value) + { // Skip comparison of the first element with itself for (label i = 1; i < nElems; i++) { @@ -169,6 +178,7 @@ Foam::UListProxy::determineUniformity() const break; } } + } return u; } diff --git a/src/foam/db/IOstreams/SliceStreams/primitives_traits.H b/src/foam/db/IOstreams/SliceStreams/primitives_traits.H index 0768c1ba2..217237961 100644 --- a/src/foam/db/IOstreams/SliceStreams/primitives_traits.H +++ b/src/foam/db/IOstreams/SliceStreams/primitives_traits.H @@ -108,6 +108,25 @@ struct is_vectorspace std::true_type {}; +/****************** TODO port: hacks to circumvent errors in UListIO.C >>>>>>>>>>>>>>>*/ + +// IS_INEQUALITY_COMPARABLE +// primary template +template> +struct is_inequality_comparable : std::false_type {}; + +//partial specialization, maybe SFINAE'd away +template +struct is_inequality_comparable +< + T, + Void_T() != std::declval())> +> +: + std::true_type +{}; + +/*<<<<<<<<<<<<<<<<<<<<< TODO port: hacks to circumvent errors in UListIO.C *************/ // TODO: This should probably go somewhere else. Toward VectorSpace ecosystem? template diff --git a/wmake/rules/linux64Gcc/c++ b/wmake/rules/linux64Gcc/c++ index 19e6f87ce..ad398da2d 100644 --- a/wmake/rules/linux64Gcc/c++ +++ b/wmake/rules/linux64Gcc/c++ @@ -5,7 +5,8 @@ c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual # Suppress some warnings for flex++ and CGAL 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)