Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Comparison Operator cannot be Found #1

Open
half-potato opened this issue Dec 29, 2023 · 0 comments
Open

Comparison Operator cannot be Found #1

half-potato opened this issue Dec 29, 2023 · 0 comments

Comments

@half-potato
Copy link

half-potato commented Dec 29, 2023

/usr/include/c++/13.2.1/bits/stl_function.h:408:20: error: no match for ‘operator<’ (operand types are ‘const tinyobj::index_t’ and ‘const tinyobj::index_t’)
  408 |       { return __x < __y; }

Solution:
namespace std >>> namespace tinyobj

New, Correct Code:

namespace tinyobj {
inline bool operator<(const tinyobj::index_t &a, const tinyobj::index_t &b) {
  if (a.vertex_index < b.vertex_index)
    return true;
  if (a.vertex_index > b.vertex_index)
    return false;

  if (a.normal_index < b.normal_index)
    return true;
  if (a.normal_index > b.normal_index)
    return false;

  if (a.texcoord_index < b.texcoord_index)
    return true;
  if (a.texcoord_index > b.texcoord_index)
    return false;

  return false;
}
} // namespace tinyobj
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant