MCPcopy Create free account
hub / github.com/Notgnoshi/generative / dynamic_unique_ptr_cast

Function dynamic_unique_ptr_cast

generative/io/tgf-graph-reader.cpp:40–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38// deleter.
39template<typename Derived_t, typename Base_t>
40static std::unique_ptr<Derived_t> dynamic_unique_ptr_cast(std::unique_ptr<Base_t>&& p)
41{
42 if (auto* result = dynamic_cast<Derived_t*>(p.get()))
43 {
44 (void)p.release();
45 return std::unique_ptr<Derived_t>(result);
46 }
47 return std::unique_ptr<Derived_t>(nullptr);
48}
49
50static std::string trim(const std::string& str, const std::string& whitespace = " \t\n")
51{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected