#ifndef QLOW_UTIL_H #define QLOW_UTIL_H #include #include #include namespace qlow { template using OwningList = std::vector>; /// i don't like this, but I lack better ideas at the moment. /// TODO: find better solution /*! * \brief tries to cast a unique_ptr and throws if it fails */ template std::unique_ptr unique_dynamic_cast(std::unique_ptr&& p) { U* released = p.release(); if (T* casted = dynamic_cast(released); casted) return std::unique_ptr (casted); else { delete released; throw "invalid unique_dynamic_cast"; } } namespace util { inline std::string toString(const void* a) { std::ostringstream o; o << a; return o.str(); } } } #endif // QLOW_UTIL_H