KDAB / cxx-qt

Safe interop between Rust and Qt
https://kdab.github.io/cxx-qt/book/
1k stars 67 forks source link

CXX-Qt-Lib: Add CXX-compatible templates for make_unique, make_shared, etc. #823

Open LeonMatthesKDAB opened 7 months ago

LeonMatthesKDAB commented 7 months ago

To complete our list of templated constructors in cxx-qt-lib/common.h.

We probably want to have at least:

ahayzen-kdab commented 7 months ago

Note this is also something that if cxx-qt-lib is split out could go into cxx-qt or a -common thing later :thinking:

ahayzen-kdab commented 6 months ago

See comments in #840, consider having an up and downcast helper

template<typename Base, typename T>
Base & upcast(T& t)
{
   // Maybe add some static_assert that Base is indeed base class of T
    return static_cast<Base&>(t);
}