![]() |
Connect++ 0.6.1
A fast, readable connection prover for first-order logic.
|
If you implement the stacks used by the prover as a vector<StackItem> then every time you move down the stack a StackItem destructor is called. This ends up eating about 1/6th of the runtime, and is completely unnecessary. More...
#include <Stack.hpp>
Public Member Functions | |
Stack () | |
The constructor is straightforward - just make some initial space in the vector. | |
void | clear () |
Exact analogue of the same function for vector<>. | |
bool | empty () const |
Exact analogue of the same function for vector<>. | |
size_t | size () const |
Exact analogue of the same function for vector<>. | |
void | push_back (const StackItem &_item) |
Exact analogue of the same function for vector<>. | |
StackItem & | back () |
Exact analogue of the same function for vector<>. | |
void | pop_back () |
Exact analogue of the same function for vector<>. BUT - importantly - avoid calling the StackItem destructor. | |
StackItem & | operator[] (size_t _i) |
Exact analogue of the same function for vector<>. | |
void | emplace_back (StackItemType sit, const Clause &_c, const SimplePath &_p, const Lemmata &_l, uint32_t _d) |
(Almost!) exact analogue of the same function for vector<>. | |
void | emplace_back (StackItemType sit, const Clause &_c, const SimplePath &_p, const Lemmata &_l, const Substitution &_sub, uint32_t _d) |
(Almost!) exact analogue of the same function for vector<>. | |
Private Member Functions | |
void | extend (size_t _n) |
Make extra space later if needed. | |
Private Attributes | |
StackItem * | stack |
The idea is to store the stack here, but to never actually remove anything from it, so we avoid calling the destructor for StackItem. | |
size_t | next_item_index |
Keep track of where the next empty space is. | |
size_t | capacity |
Keep track of how much space we have. If we need more then extend as needed. | |
Friends | |
ostream & | operator<< (ostream &out, Stack &_s) |
If you implement the stacks used by the prover as a vector<StackItem> then every time you move down the stack a StackItem destructor is called. This ends up eating about 1/6th of the runtime, and is completely unnecessary.
This class just wraps a stack up in such a way that StackItems get left in place when moving down the stack, and overwritten when moving up. A bunch of space is initialised at the outset and extended whenever necessary.
|
inline |
The constructor is straightforward - just make some initial space in the vector.
Definition at line 75 of file Stack.hpp.
|
inline |
Exact analogue of the same function for vector<>.
|
inline |
Exact analogue of the same function for vector<>.
|
inline |
(Almost!) exact analogue of the same function for vector<>.
Strictly speaking it doesn't do exactly the same thing, because we only want to copy into existing storage, without risking actually constructing (and destructing) a StackItem.
Definition at line 158 of file Stack.hpp.
|
inline |
(Almost!) exact analogue of the same function for vector<>.
Strictly speaking it doesn't do exactly the same thing, because we only want to copy into existing storage, without risking actually constructing (and destructing) a StackItem.
Definition at line 132 of file Stack.hpp.
|
inline |
Exact analogue of the same function for vector<>.
|
inlineprivate |
|
inline |
|
inline |
Exact analogue of the same function for vector<>. BUT - importantly - avoid calling the StackItem destructor.
|
inline |
|
inline |
Exact analogue of the same function for vector<>.
|
friend |
|
private |
|
private |
|
private |