Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SharedLibrary::Handle no longer defines the hash function in std #3625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions include/common/mir/shared_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ class SharedLibrary
auto operator<=>(Handle const& rhs) const -> std::strong_ordering;
auto operator==(Handle const& rhs) const -> bool = default;
auto operator!=(Handle const& rhs) const -> bool = default;

struct HandleHash
{
std::size_t operator()(const Handle& h) const noexcept
{
return std::hash<void*>{}(h.handle);
}
};
private:
friend class SharedLibrary;
friend struct std::hash<Handle>;

Handle(void* handle);
void* handle;
Expand All @@ -75,10 +82,4 @@ class SharedLibrary
};
}

template<>
struct std::hash<mir::SharedLibrary::Handle>
{
auto operator()(mir::SharedLibrary::Handle const& h) const noexcept -> std::size_t;
};

#endif /* MIR_SHARED_LIBRARY_H_ */
4 changes: 2 additions & 2 deletions include/platform/mir/options/default_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class DefaultConfiguration : public Configuration
std::function<void(int argc, char const* const* argv)> const unparsed_arguments_handler;
std::shared_ptr<boost::program_options::options_description> const program_options;

std::unordered_map<SharedLibrary::Handle, boost::program_options::options_description> module_options_desc;
std::unordered_map<SharedLibrary::Handle, std::shared_ptr<Option>> mutable module_options;
std::unordered_map<SharedLibrary::Handle, boost::program_options::options_description, SharedLibrary::Handle::HandleHash> module_options_desc;
std::unordered_map<SharedLibrary::Handle, std::shared_ptr<Option>, SharedLibrary::Handle::HandleHash> mutable module_options;
std::shared_ptr<Option> mutable options;
};
}
Expand Down
6 changes: 0 additions & 6 deletions src/common/sharedlibrary/shared_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,3 @@ auto mir::SharedLibrary::Handle::operator<=>(Handle const& rhs) const -> std::st
{
return handle <=> rhs.handle;
}

auto std::hash<mir::SharedLibrary::Handle>::operator()(mir::SharedLibrary::Handle const& handle) const noexcept
-> std::size_t
{
return std::hash<void*>{}(handle.handle);
}
9 changes: 7 additions & 2 deletions src/common/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -691,18 +691,23 @@ global:
};

MIR_COMMON_2.18 {
global: extern "C++" {
global:
extern "C++" {
MirTouchpadConfig::disable_with_external_mouse*;
mir::event_type_to_c_str*;
};
} MIR_COMMON_2.17;

MIR_COMMON_2.19 {
global: extern "C++" {
global:
extern "C++" {
mir::SharedLibrary::Handle::?Handle*;
mir::SharedLibrary::Handle::operator*;
mir::SharedLibrary::get_handle*;
mir::SharedLibrary::Handle::HandleHash::operator*;
std::hash?mir::SharedLibrary::Handle?::operator*;
typeinfo?for?mir::SharedLibrary::Handle;
typeinfo?for?mir::SharedLibrary::Handle::HandleHash;
};
} MIR_COMMON_2.18;

Loading