54 std::multimap<std::pair<u64, u64>, T> data;
56 using iterator =
typename std::multimap<std::pair<u64, u64>, T>::iterator;
64 inline std::multimap<std::pair<u64, u64>, T> &
get_native() {
return data; }
67 inline const std::multimap<std::pair<u64, u64>, T> &
get_native()
const {
return data; }
70 inline auto begin() {
return data.begin(); }
72 inline auto end() {
return data.end(); }
74 inline auto begin()
const {
return data.begin(); }
76 inline auto end()
const {
return data.end(); }
78 inline auto cbegin()
const {
return data.cbegin(); }
80 inline auto cend()
const {
return data.cend(); }
111 for (
auto &[
id,
obj] : data) {
118 for (
auto &[
id,
obj] : data) {
146 for (
auto &[k, v] : data) {
147 if (cd(k.first, k.second)) {
153 auto ext = data.extract(p);
154 other.data.insert(std::move(ext));
172 return (data.find({left_id, right_id}) != data.end());
223 inline void reset() { data.clear(); }
230 inline bool is_empty()
const {
return data.empty(); }
std::uint64_t u64
64 bit unsigned integer
Container for objects shared between two distributed data elements.
DistributedDataShared< Tmap > map(std::function< Tmap(u64, u64, T &)> map_func)
Transform all objects to a new type using a mapping function.
DistributedDataShared< Tmap > map(std::function< Tmap(u64, u64, const T &)> map_func) const
const version
u64 get_element_count() const
Get the total number of objects in the container.
auto begin()
iterator forwarding
bool has_key(u64 left_id, u64 right_id) const
Check if a patch pair exists in the container.
void for_each(std::function< void(u64, u64, T &)> &&f)
Apply a function to all stored objects.
auto cbegin() const
iterator forwarding
bool is_empty() const
Check if the container is empty.
auto cend() const
iterator forwarding
void for_each(std::function< void(u64, u64, const T &)> &&f) const
const version
iterator add_obj(u64 left_id, u64 right_id, T &&obj)
Add an object associated with a patch pair.
std::multimap< std::pair< u64, u64 >, T > & get_native()
Get direct access to the underlying multimap container.
auto end() const
iterator forwarding
auto end()
iterator forwarding
void reset()
Clear all objects from the container.
const std::multimap< std::pair< u64, u64 >, T > & get_native() const
const version
auto begin() const
iterator forwarding
void tranfer_all(std::function< bool(u64, u64)> cd, DistributedDataShared &other)
Transfer objects to another container based on a condition.
namespace for basic c++ utilities
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.