opm-core/opm/core/utility/Event_impl.hpp
Roland Kaufmann 3156d0749a Add classes for event-handling
The new classes Event and EventSource can be used as a simple mechanism
for implementing event-based callbacks in the simulators.
2013-08-26 12:52:03 +02:00

14 lines
491 B
C++

// Copyright (C) 2013 Uni Research AS
// This file is licensed under the GNU General Public License v3.0
#ifndef OPM_EVENT_HEADER_INCLUDED
#error Do NOT include this file directly!
#endif /* OPM_EVENT_HEADER_INCLUDED */
template <typename T, void (T::*member)()> inline Event&
Event::add (T& t) {
// wrap the member function in a std::function and add that
// notice the use of ref() to avoid invoking the copy constructor
return this->add (std::bind (member, std::ref(t)));
}