From d12becf4034b5df502c5da97ec582677fab0d467 Mon Sep 17 00:00:00 2001 From: rdeioris Date: Sun, 27 Oct 2024 12:58:59 +0100 Subject: [PATCH] added lexicographical_compare dummy implementation for being compliant with c++14 --- src/prim-types.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/prim-types.cc b/src/prim-types.cc index b14092b2..2dc5afd4 100644 --- a/src/prim-types.cc +++ b/src/prim-types.cc @@ -38,6 +38,21 @@ namespace tinyusdz { +template +bool lexicographical_compare(InputIt1 first1, InputIt1 last1, + InputIt2 first2, InputIt2 last2) +{ + for (; (first1 != last1) && (first2 != last2); ++first1, (void) ++first2) + { + if (*first1 < *first2) + return true; + if (*first2 < *first1) + return false; + } + + return (first1 == last1) && (first2 != last2); +} + nonstd::optional InterpolationFromString(const std::string &v) { if ("faceVarying" == v) { return Interpolation::FaceVarying; @@ -380,7 +395,7 @@ bool Path::LessThan(const Path &lhs, const Path &rhs) { return lhs_prop_part.empty(); } - return std::lexicographical_compare( + return ::tinyusdz::lexicographical_compare( lhs_prop_part.begin(), lhs_prop_part.end(), rhs_prop_part.begin(), rhs_prop_part.end()); @@ -425,7 +440,7 @@ bool Path::LessThan(const Path &lhs, const Path &rhs) { // DCOUT("child_idx = " << child_idx); // compare child node - return std::lexicographical_compare( + return ::tinyusdz::lexicographical_compare( lhs_prim_names[child_idx].begin(), lhs_prim_names[child_idx].end(), rhs_prim_names[child_idx].begin(), rhs_prim_names[child_idx].end()); }