Re: Glib::VariantBase usage examples



On Fri, 2011-03-25 at 12:54 +0200, Povietkin Konstantin wrote:
> > Variant< std::vector<Glib::ustring> > derived =
> > VariantBase::cast_dynamic< Variant< std::vector<Glib::ustring> >
> > >(base);
> I tried to do in this way, but I got std::bad_cast exception. 

Variant< std::vector<T> > is for arrays, not tuples:
http://library.gnome.org/devel/glibmm/unstable/classGlib_1_1Variant_3_01std_1_1vector_3_01T_01_4_01_4.html#_details

I guess it would be nice to have sometime more strongly typed than
VariantContainerBase for tuples. Maybe we could use Variant<
std::vector<T> > for both somehow. But for now, I suggest that you just
use VariantContainerBase.

In fact, please test glibmm 2.27.99.1, which I just released, to see if
the new API makes it easier.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]