Just like normal pointers, you can check whether a
RefPtr
points to anything.
Glib::RefPtr<Gtk::TreeModel> refModel = m_TreeView.get_model(); if(refModel) { int cols_count = refModel->get_n_columns(); ... }
But unlike normal pointers, RefPtr
s are automatically
initialized to null so you don't need to remember to do that yourself.