mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
Merge branch 'type-traits-glib-min-version' into 'master'
glib/gmacros.h: Move `<type_traits>` include to consumers Closes #2331 See merge request GNOME/glib!1963
This commit is contained in:
commit
b3b829e309
@ -26,6 +26,11 @@
|
||||
|
||||
#include <glib/gtypes.h>
|
||||
|
||||
#if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
/* for glib_typeof */
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
|
@ -238,7 +238,12 @@
|
||||
#define glib_typeof(t) __typeof__ (t)
|
||||
#elif defined(__cplusplus) && __cplusplus >= 201103L
|
||||
/* C++11 decltype() is close enough for our usage */
|
||||
#include <type_traits>
|
||||
/* This needs `#include <type_traits>`, but we have guarded this feature with a
|
||||
* `GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68` check, and such a check
|
||||
* cannot be enforced in this header due to include ordering requirements.
|
||||
* Within GLib itself, which use `glib_typeof` need to add the include
|
||||
* themselves. See other examples in GLib for how to do this.
|
||||
*/
|
||||
#define glib_typeof(t) typename std::remove_reference<decltype (t)>::type
|
||||
#define glib_typeof_2_68
|
||||
#endif
|
||||
|
@ -31,6 +31,11 @@
|
||||
|
||||
#include <glib/gutils.h>
|
||||
|
||||
#if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
/* for glib_typeof */
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,11 @@
|
||||
|
||||
#include <glib/gmem.h>
|
||||
|
||||
#if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
/* for glib_typeof */
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GLIB_AVAILABLE_IN_2_58
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include <gobject/gsignal.h>
|
||||
#include <gobject/gboxed.h>
|
||||
|
||||
#if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
/* for glib_typeof */
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* --- type macros --- */
|
||||
|
Loading…
Reference in New Issue
Block a user