-/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <map>
#include <utility>
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
template <class S> class signal;
/** Fire that signal, invoking all callbacks */
R operator()(P... args) const
{
- for (auto const& handler : handlers_)
- handler.second(args...);
+ for (auto const& [_, callback] : handlers_)
+ callback(args...);
}
/** Remove a callback */
void disconnect(unsigned int id) { handlers_.erase(id); }
/** Remove all callbacks */
void disconnect_slots() { handlers_.clear(); }
- /** Get the amount of callbacks */
- int get_slot_count() { return handlers_.size(); }
};
-}
-}
+} // namespace simgrid::xbt
#endif