libinvdb/source/include/cxx-semantics.hh

39 lines
601 B
C++

#ifndef INVENTORY_CXX_SEMANTICS_HH_
#define INVENTORY_CXX_SEMANTICS_HH_
#include <cstddef>
namespace inventory {
namespace semantics {
class non_constructible {
non_constructible() {}
};
template<class Derived>
class singleton {
public:
static Derived &instance() {
if (s_instance == NULL)
s_instance = new Derived;
return *s_instance;
}
protected:
singleton() {}
private:
static Derived *s_instance;
};
template<typename... Args>
class visitor {
public:
virtual void apply(Args... args) = 0;
};
}
}
#include "cxx-semantics_impl.hh"
#endif