Skip to content

Commit 7eaacd0

Browse files
committed
get value of Nullable
1 parent e729efa commit 7eaacd0

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/rampl.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,18 +318,11 @@ bool RAMPL::isRunning() const {
318318
:param string solver: The solver that will be used to solve the problem.
319319
:raises Error: If the underlying interpreter is not running.
320320
*/
321-
void RAMPL::solve(Rcpp::Nullable<std::string> problem = R_NilValue, Rcpp::Nullable<std::string> solver = R_NilValue) {
322-
if (problem.isNotNull() && solver.isNotNull())
323-
_impl.solve(problem, solver);
324-
else if (problem.isNotNull())
325-
_impl.solve(problem, "");
326-
else if (solver.isNotNull())
327-
_impl.solve("", solver);
328-
else
329-
_impl.solve("", "");
330-
331-
332-
//return _impl.solve("", ""); // FIXME: does not print to stdout with R IDE on Windows
321+
void RAMPL::solve(Rcpp::Nullable<std::string> problem, Rcpp::Nullable<std::string> solver) {
322+
std::string cpp_problem = problem.isNotNull() ? problem.getValue() : "";
323+
std::string cpp_solver = solver.isNotNull() ? solver.getValue() : "";
324+
325+
_impl.solve(cpp_problem, cpp_solver);
333326
}
334327

335328

0 commit comments

Comments
 (0)