From: Aina Niemetz Date: Wed, 1 Aug 2018 18:36:30 +0000 (-0700) Subject: New C++ API: Fixed ownership of options object. (#2243) X-Git-Tag: cvc5-1.0.0~4837 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c85d906d4fc8da9e31d96804ccbf6d52ec22cdd5;p=cvc5.git New C++ API: Fixed ownership of options object. (#2243) --- diff --git a/src/api/cvc4cpp.cpp b/src/api/cvc4cpp.cpp index 10c0c8e26..19d7840a8 100644 --- a/src/api/cvc4cpp.cpp +++ b/src/api/cvc4cpp.cpp @@ -1429,12 +1429,12 @@ size_t RoundingModeHashFunction::operator()(const RoundingMode& rm) const /* Solver */ /* -------------------------------------------------------------------------- */ -Solver::Solver(Options* opts) : d_opts(new Options()) +Solver::Solver(Options* opts) { - if (opts) d_opts->copyValues(*opts); - d_exprMgr = std::unique_ptr(new ExprManager(*d_opts)); + d_exprMgr = std::unique_ptr( + opts == nullptr ? new ExprManager(Options()) : new ExprManager(*opts)); d_smtEngine = std::unique_ptr(new SmtEngine(d_exprMgr.get())); - d_rng = std::unique_ptr(new Random((*d_opts)[options::seed])); + d_rng = std::unique_ptr(new Random((*opts)[options::seed])); } Solver::~Solver() {} diff --git a/src/api/cvc4cpp.h b/src/api/cvc4cpp.h index b76fbb08f..c3c429009 100644 --- a/src/api/cvc4cpp.h +++ b/src/api/cvc4cpp.h @@ -2355,8 +2355,6 @@ class CVC4_PUBLIC Solver /* Helper to convert a vector of sorts to internal types. */ std::vector termVectorToExprs(const std::vector& vector) const; - /* The options of this solver. */ - std::unique_ptr d_opts; /* The expression manager of this solver. */ std::unique_ptr d_exprMgr; /* The SMT engine of this solver. */