3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-20 10:10:21 +00:00

merge LRA

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-05-09 10:46:11 -07:00
parent 085d31dca2
commit 911b24784a
120 changed files with 23069 additions and 15 deletions

View file

@ -0,0 +1,65 @@
/*
Copyright (c) 2017 Microsoft Corporation
Author: Lev Nachmanson
*/
#pragma once
// add to value the stack semantics
#include <stack>
namespace lean {
template <typename T> class stacked_value {
T m_value;
std::stack<T> m_stack;
public:
void push() {
m_stack.push(m_value);
}
unsigned stack_size() const {
return static_cast<unsigned>(m_stack.size());
}
void pop() {
pop(1);
}
void pop(unsigned k) {
while (k-- > 0) {
if (m_stack.empty())
return;
m_value = m_stack.top();
m_stack.pop();
}
}
stacked_value() {}
stacked_value(const T& m) {
m_value = m;
}
stacked_value(const T&& m) {
m_value = std::move(m);
}
T& operator=(T arg) { // copy/move constructor
m_value = arg;
return m_value;
}
operator T&() {
return m_value;
}
operator const T&() const {
return m_value;
}
T & operator()() {
return m_value;
}
const T & operator()() const {
return m_value;
}
};
}