Skip to content

Commit

Permalink
Merge pull request #201 from rdeioris/cpp14_compliance
Browse files Browse the repository at this point in the history
added lexicographical_compare dummy implementation for being compliant with c++14
  • Loading branch information
syoyo authored Oct 27, 2024
2 parents 0693cae + d12becf commit 3fb00d1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/prim-types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@

namespace tinyusdz {

template<class InputIt1, class InputIt2>
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<Interpolation> InterpolationFromString(const std::string &v) {
if ("faceVarying" == v) {
return Interpolation::FaceVarying;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 3fb00d1

Please sign in to comment.