@@ -175,27 +175,35 @@ static void emit_solver_warning(
175175}
176176
177177template <typename SatcheckT>
178- static std::unique_ptr<SatcheckT>
178+ static typename std::enable_if<
179+ !std::is_base_of<hardness_collectort, SatcheckT>::value,
180+ std::unique_ptr<SatcheckT>>::type
179181make_satcheck_prop (message_handlert &message_handler, const optionst &options)
180182{
181183 auto satcheck = std::make_unique<SatcheckT>(message_handler);
182184 if (options.is_set (" write-solver-stats-to" ))
183185 {
184- if (
185- auto hardness_collector = dynamic_cast <hardness_collectort *>(&*satcheck))
186- {
187- std::unique_ptr<solver_hardnesst> solver_hardness =
188- std::make_unique<solver_hardnesst>();
189- solver_hardness->set_outfile (options.get_option (" write-solver-stats-to" ));
190- hardness_collector->solver_hardness = std::move (solver_hardness);
191- }
192- else
193- {
194- messaget log (message_handler);
195- log.warning ()
196- << " Configured solver does not support --write-solver-stats-to. "
197- << " Solver stats will not be written." << messaget::eom;
198- }
186+ messaget log (message_handler);
187+ log.warning ()
188+ << " Configured solver does not support --write-solver-stats-to. "
189+ << " Solver stats will not be written." << messaget::eom;
190+ }
191+ return satcheck;
192+ }
193+
194+ template <typename SatcheckT>
195+ static typename std::enable_if<
196+ std::is_base_of<hardness_collectort, SatcheckT>::value,
197+ std::unique_ptr<SatcheckT>>::type
198+ make_satcheck_prop (message_handlert &message_handler, const optionst &options)
199+ {
200+ auto satcheck = std::make_unique<SatcheckT>(message_handler);
201+ if (options.is_set (" write-solver-stats-to" ))
202+ {
203+ std::unique_ptr<solver_hardnesst> solver_hardness =
204+ std::make_unique<solver_hardnesst>();
205+ solver_hardness->set_outfile (options.get_option (" write-solver-stats-to" ));
206+ satcheck->solver_hardness = std::move (solver_hardness);
199207 }
200208 return satcheck;
201209}
0 commit comments