Re: GThread struct now hidden



2011-11-23 13:51, Murray Cumming skrev:

Unfortunately, glibmm now does not build with --enable-warnings=fatal:

template<class T>  inline
Private<T>::Private(typename Private<T>::DestructorFunc destructor_func)
{
  //TODO: This causes this warning:
  //extended initializer lists only available with -std=c++0x or -std=gnu
++0x
  //See glib bug: https://bugzilla.gnome.org/show_bug.cgi?id=664618
  //We can work around this by building like so:
  //./configure --prefix=/opt/gnome30 'CXXFLAGS=-std=c++0x'
  gobject_ = G_PRIVATE_INIT(destructor_func);
}

#define G_PRIVATE_INIT(notify) { NULL, (notify), { NULL, NULL } }
can be used for initialization, but it can't be used for assignment. This version builds:

template <class T> inline
Private<T>::Private(typename Private<T>::DestructorFunc destructor_func)
{
  GPrivate temp = G_PRIVATE_INIT(destructor_func);
  gobject_ = temp;
}

I similar trick is used in glib/glib/deprecated/gthread-deprecated.c, function g_private_new().



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