entt: error: "use of overloaded operator '!=' is ambiguous" for `dense_map`-iterator?
So I’m trying to use entt and copied the single-include header of version 3.12.2 into my project’s directory.
For some reason, if I try to compile my code with entt (using clang 15.0.7 on WSL2, also tried with clang 14.0.0) I get the following error:
[project's path]/inc/ECS/entt.hpp:37953:24: error: use of overloaded operator '!=' is ambiguous (with operand types 'entt::dense_map<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>, entt::identity>::iterator' (aka 'dense_map_iterator<__normal_iterator<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>> *, std::vector<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>>') and 'entt::dense_map<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>, entt::identity>::iterator')
for(auto &&curr: pools) {
^
[project's path]/inc/ECS/entt.hpp:38003:9: note: in instantiation of member function 'entt::basic_registry<>::rebind' requested here
rebind();
^
[project's path]/inc/Log/Log.h:16:45: note: in instantiation of member function 'entt::basic_registry<>::basic_registry' requested here
: m_filePath(filePath), m_logEntries({}), m_container({})
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_relops.h:87:7: note: candidate function [with _Tp = entt::internal::dense_map_iterator<__gnu_cxx::__normal_iterator<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>> *, std::vector<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>>]
operator!=(const _Tp& __x, const _Tp& __y)
^
[project's path]/inc/ECS/entt.hpp:3167:30: note: candidate function [with Lhs = __gnu_cxx::__normal_iterator<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>> *, std::vector<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>, Rhs = __gnu_cxx::__normal_iterator<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>> *, std::vector<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>]
[[nodiscard]] constexpr bool operator!=(const dense_map_iterator<Lhs> &lhs, const dense_map_iterator<Rhs> &rhs) noexcept {
^
[project's path]/inc/ECS/entt.hpp:37953:26: note: in implicit call to 'operator!=' for iterator of type 'entt::basic_registry<>::pool_container_type' (aka 'dense_map<unsigned int, shared_ptr<basic_sparse_set<entt::entity, std::allocator<entt::entity>>>, entt::identity, equal_to<unsigned int>, allocator<std::pair<const unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>')
for(auto &&curr: pools) {
^~~~~
[project's path]/inc/ECS/entt.hpp:3493:28: note: selected 'begin' function with iterator type 'entt::dense_map<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>, entt::identity>::iterator' (aka 'dense_map_iterator<__normal_iterator<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>> *, std::vector<entt::internal::dense_map_node<unsigned int, std::shared_ptr<entt::basic_sparse_set<>>>>>>')
[[nodiscard]] iterator begin() noexcept {
^
1 error generated.
The file with the Log-class where the registry gets initiated looks like this:
// Log.h
#ifndef LOG_H
#define LOG_H
#include <Log/LogEntry.h>
#include <jsoncpp/json.h>
#include <vector>
#include <memory>
#include <regex>
class FileParser;
class Log
{
friend class FileParser;
public:
Log(const std::string& filePath = "")
: m_filePath(filePath), m_logEntries({}), m_container({})
{}
~Log() { m_container.clear(); }
public:
std::weak_ptr<LogEntry> createLogEntry();
void deleteLogEntry(const std::weak_ptr<LogEntry>& toDelete);
const std::vector<std::shared_ptr<LogEntry>>& getEntries() const { return m_logEntries; }
const std::string& getFilePath() const { return m_filePath; }
Json::Value toJSON() const;
void setFilePath(const std::string& newFilePath) { m_filePath = newFilePath; }
private:
std::string m_filePath;
std::vector<std::shared_ptr<LogEntry>> m_logEntries;
entt::registry m_container;
};
#endif
Is this a bug or did I mess something up?
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 18 (6 by maintainers)
Yeah, you’re right. Of course it was the compiler, but it was complaining about multiple matches because of
enttand rel_ops having definitions for that operator.User-error by me and with that I’ll close this issue