Skip to content

Commit

Permalink
SharedLibrary::Handle no longer defines the hash function in std
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Oct 7, 2024
1 parent 008af61 commit d57046f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
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);
}
12 changes: 9 additions & 3 deletions src/common/symbols.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MIR_COMMON_2.17 {

bcmnopqrstuvwxyz1234567890 MIR_COMMON_2.17 {
global:
mir_arrow_cursor_name;
mir_busy_cursor_name;
Expand Down Expand Up @@ -691,18 +692,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;

0 comments on commit d57046f

Please sign in to comment.