TankOs/SFGUI — Issue #36: Add Widget::ConstPtr
Author: Iteem
Created: 2011-10-12 10:05:33+00:00
State: open

It would be nice to have a typdef for a ConstPtr and not only Ptr in every widget. Its just a
'''c++
typedef boost::shared_ptr ConstPtr;
'''
Is there anything that speaks against that?

A bit off topic, but it seems it's not possible to call "const WidgetsList& GetChildren() const;"
The problem is the following
'''c++
sfg::Container::Ptr container = sfg::Container::Create();
const WidgetsList& widgets = container->GetChildren(); //Error: tries to call the non-const version of GetChildren, but this version is protected
const WidgetsList& widgets = static_cast< boost::shared_ptr< const sfg::Container > >( container )->GetChildren(); //works, but...
const WidgetsList& widgets = static_cast< sfg::Container::ConstPtr >( container )->GetChildren(); //at least a bit better ;)
'''