feat(kernel/definition): default constructor for definitions

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-04-18 13:10:05 -07:00
parent 984ac03ac7
commit 234abb1238
2 changed files with 12 additions and 0 deletions

View file

@ -59,6 +59,9 @@ struct definition::cell {
} }
}; };
definition g_dummy = mk_axiom(name(), param_names(), level_cnstrs(), expr());
definition::definition():definition(g_dummy) {}
definition::definition(cell * ptr):m_ptr(ptr) {} definition::definition(cell * ptr):m_ptr(ptr) {}
definition::definition(definition const & s):m_ptr(s.m_ptr) { if (m_ptr) m_ptr->inc_ref(); } definition::definition(definition const & s):m_ptr(s.m_ptr) { if (m_ptr) m_ptr->inc_ref(); }
definition::definition(definition && s):m_ptr(s.m_ptr) { s.m_ptr = nullptr; } definition::definition(definition && s):m_ptr(s.m_ptr) { s.m_ptr = nullptr; }

View file

@ -20,6 +20,15 @@ class definition {
explicit definition(cell * ptr); explicit definition(cell * ptr);
friend class cell; friend class cell;
public: public:
/**
\brief The default constructor creates a reference to a "dummy"
definition. The actual "dummy" definition is not relevant, and
no procedure should rely on the kind of definition used.
We have a default constructor because some collections only work
with types that have a default constructor.
*/
definition();
definition(definition const & s); definition(definition const & s);
definition(definition && s); definition(definition && s);
~definition(); ~definition();