Skip to content

Commit

Permalink
[#488] Move std::hash implementation in separate file to fix clang-ti…
Browse files Browse the repository at this point in the history
…dy scan bug
  • Loading branch information
elfenpiff committed Oct 25, 2024
1 parent 75cb1cc commit 355b962
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
15 changes: 0 additions & 15 deletions iceoryx2-ffi/cxx/include/iox2/waitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,4 @@ class WaitSetBuilder {
iox2_waitset_builder_h m_handle;
};
} // namespace iox2

template <>
struct std::hash<iox2::WaitSetAttachmentId<iox2::ServiceType::Ipc>> {
auto operator()(const iox2::WaitSetAttachmentId<iox2::ServiceType::Ipc>& self) -> std::size_t {
return self.hash();
}
};

template <>
struct std::hash<iox2::WaitSetAttachmentId<iox2::ServiceType::Local>> {
auto operator()(const iox2::WaitSetAttachmentId<iox2::ServiceType::Local>& self) -> std::size_t {
return self.hash();
}
};

#endif
32 changes: 32 additions & 0 deletions iceoryx2-ffi/cxx/include/iox2/waitset_hash.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2024 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available under the
// terms of the Apache Software License 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
// which is available at https://opensource.org/licenses/MIT.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT

#ifndef IOX2_WAITSET_HASH_HPP
#define IOX2_WAITSET_HASH_HPP

#include "iox2/waitset.hpp"

template <>
struct std::hash<iox2::WaitSetAttachmentId<iox2::ServiceType::Ipc>> {
auto operator()(const iox2::WaitSetAttachmentId<iox2::ServiceType::Ipc>& self) -> std::size_t {
return self.hash();
}
};

template <>
struct std::hash<iox2::WaitSetAttachmentId<iox2::ServiceType::Local>> {
auto operator()(const iox2::WaitSetAttachmentId<iox2::ServiceType::Local>& self) -> std::size_t {
return self.hash();
}
};

#endif

0 comments on commit 355b962

Please sign in to comment.