Switch to C++17

With C++17, optionals, an experimental language feature, were moved to
the “std” namespace. This makes C++17 mandatory and drops the now
obsolete “experimental” namespace.
This commit is contained in:
2018-03-22 17:20:54 +01:00
committed by Patrick Lühne
parent c7d1026a31
commit 22238bb398
9 changed files with 48 additions and 48 deletions

View File

@@ -27,7 +27,7 @@ void VariableStack::pop()
////////////////////////////////////////////////////////////////////////////////////////////////////
std::experimental::optional<VariableDeclaration *> VariableStack::findUserVariableDeclaration(const char *variableName) const
std::optional<VariableDeclaration *> VariableStack::findUserVariableDeclaration(const char *variableName) const
{
const auto variableDeclarationMatches =
[&variableName](const auto &variableDeclaration)
@@ -45,7 +45,7 @@ std::experimental::optional<VariableDeclaration *> VariableStack::findUserVariab
return matchingVariableDeclaration->get();
}
return std::experimental::nullopt;
return std::nullopt;
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,6 +1,6 @@
#include <anthem/Simplification.h>
#include <experimental/optional>
#include <optional>
#include <anthem/ASTCopy.h>
#include <anthem/ASTVisitors.h>
@@ -27,15 +27,15 @@ bool matchesVariableDeclaration(const ast::Term &term, const ast::VariableDeclar
// Extracts the term t if the given formula is of the form “X = t” and X matches the given variable
// The input formula is no longer usable after this call if a term is returned
std::experimental::optional<ast::Term> extractAssignedTerm(ast::Formula &formula, const ast::VariableDeclaration &variableDeclaration)
std::optional<ast::Term> extractAssignedTerm(ast::Formula &formula, const ast::VariableDeclaration &variableDeclaration)
{
if (!formula.is<ast::Comparison>())
return std::experimental::nullopt;
return std::nullopt;
auto &comparison = formula.get<ast::Comparison>();
if (comparison.operator_ != ast::Comparison::Operator::Equal)
return std::experimental::nullopt;
return std::nullopt;
if (matchesVariableDeclaration(comparison.left, variableDeclaration))
return std::move(comparison.right);
@@ -43,7 +43,7 @@ std::experimental::optional<ast::Term> extractAssignedTerm(ast::Formula &formula
if (matchesVariableDeclaration(comparison.right, variableDeclaration))
return std::move(comparison.left);
return std::experimental::nullopt;
return std::nullopt;
}
////////////////////////////////////////////////////////////////////////////////////////////////////