Skip to content

Commit

Permalink
🏁 try using shared pointers to fix windows compile error
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer committed Jan 27, 2024
1 parent bc64376 commit ed893e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/mqt-core/parsers/qasm3_parser/Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace qasm3 {
class MQT_CORE_EXPORT Parser {
struct ScannerState {
private:
std::unique_ptr<std::istream> is;
std::shared_ptr<std::istream> is;

public:
Token last{0, 0};
Token t{0, 0};
Token next{0, 0};
std::unique_ptr<Scanner> scanner;
std::shared_ptr<Scanner> scanner;
std::optional<std::string> filename;
bool isImplicitInclude;

Expand All @@ -51,17 +51,17 @@ class MQT_CORE_EXPORT Parser {
std::istream* in,
std::optional<std::string> debugFilename = std::nullopt,
const bool implicitInclude = false)
: scanner(std::make_unique<Scanner>(in)),
: scanner(std::make_shared<Scanner>(in)),
filename(std::move(debugFilename)),
isImplicitInclude(implicitInclude) {
scan();
}

explicit ScannerState(
std::unique_ptr<std::istream> in,
std::shared_ptr<std::istream> in,
std::optional<std::string> debugFilename = std::nullopt,
const bool implicitInclude = false)
: is(std::move(in)), scanner(std::make_unique<Scanner>(is.get())),
: is(std::move(in)), scanner(std::make_shared<Scanner>(is.get())),
filename(std::move(debugFilename)),
isImplicitInclude(implicitInclude) {
scan();
Expand Down Expand Up @@ -120,7 +120,7 @@ class MQT_CORE_EXPORT Parser {
scanner.emplace(is);
scan();
if (implicitlyIncludeStdgates) {
scanner.emplace(std::make_unique<std::istringstream>(STDGATES),
scanner.emplace(std::make_shared<std::istringstream>(STDGATES),
"stdgates.inc", true);
scan();
}
Expand Down

0 comments on commit ed893e6

Please sign in to comment.