1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/includes/misc.hpp

16 lines
467 B
C++
Raw Permalink Normal View History

2024-11-20 14:31:49 -03:00
#ifndef MISC_HPP
#define MISC_HPP
#include <memory>
#include <utility>
namespace misc {
//Realiza um std::make_shared<TDERIVED> e converte para classe base com reinterpret_pointer_cast<TBASE>
template <typename TBASE, typename TDERIVED, class... _Types>
std::shared_ptr<TBASE> reinterpret_make_shared(_Types&&... _Args) {
auto derived = std::make_shared<TDERIVED>(std::forward<_Types>(_Args)...);
return reinterpret_pointer_cast<TBASE>(derived);
}
}
#endif