Provide template functions in separate header
Template functions must be defined in the header since the library cannot contain generic code. To keep only the interface in the main header, all such function bodies are put in a separate _impl file.
This commit is contained in:
parent
05636c70c7
commit
5644611dfd
@ -266,6 +266,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/core/simulator/BlackoilState.hpp
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.hpp
|
||||
opm/core/simulator/SimulatorIncompTwophase.hpp
|
||||
opm/core/simulator/SimulatorIncompTwophase_impl.hpp
|
||||
opm/core/simulator/SimulatorReport.hpp
|
||||
opm/core/simulator/SimulatorTimer.hpp
|
||||
opm/core/simulator/TwophaseState.hpp
|
||||
|
@ -115,9 +115,7 @@ namespace Opm
|
||||
/// sim.run (...);
|
||||
/// \endcode
|
||||
template <typename T, void (T::*callback)()>
|
||||
void connect_timestep (T& t) {
|
||||
connect_timestep_impl (boost::function0<void> (std::bind (callback, t)));
|
||||
}
|
||||
void connect_timestep (T& t);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@ -130,4 +128,6 @@ namespace Opm
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#include "SimulatorIncompTwophase_impl.hpp"
|
||||
|
||||
#endif // OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
|
||||
|
12
opm/core/simulator/SimulatorIncompTwophase_impl.hpp
Normal file
12
opm/core/simulator/SimulatorIncompTwophase_impl.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
|
||||
#error Do not include SimulatorIncompTwophase directly!
|
||||
#endif
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template <typename T, void (T::*callback)()>
|
||||
inline void SimulatorIncompTwophase::connect_timestep (T& t) {
|
||||
connect_timestep_impl (boost::function0<void> (std::bind (callback, t)));
|
||||
}
|
||||
|
||||
} /* namespace Opm */
|
Loading…
Reference in New Issue
Block a user