Checking for nullptr
Just like normal pointers, you can check whether a RefPtr points to anything.
auto refModel = m_TreeView.get_model(); if (refModel) { auto cols_count = refModel->get_n_columns(); ... }
But unlike normal pointers, RefPtrs are automatically initialized to nullptr so you don't need to remember to do that yourself.