summaryrefslogtreecommitdiff
path: root/include/libHX/defs.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:03:43 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:03:43 +0200
commitaab49e5a013c53ae812a143fe41add74e0677a61 (patch)
treef0c6e1ba7db9991f2bd38c9169f9921bfe5e61d8 /include/libHX/defs.h
parentdf5167db909a88fb8e16dd20b37442495a6ac059 (diff)
parent532d4a24e2013262dfa41fd85c06a9715c99abf7 (diff)
Update upstream source from tag 'upstream/4.7'
Update to upstream version '4.7' with Debian dir d3e11463c915e5c39507206197eb3acd42bb8f5f
Diffstat (limited to 'include/libHX/defs.h')
-rw-r--r--include/libHX/defs.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/libHX/defs.h b/include/libHX/defs.h
index 1ace518..49ca7d1 100644
--- a/include/libHX/defs.h
+++ b/include/libHX/defs.h
@@ -10,8 +10,8 @@
# endif
# ifndef containerof
# include <cstddef>
-# define containerof(var, type, member) reinterpret_cast<type *>( \
- reinterpret_cast<char *>(var) - offsetof(type, member))
+# include <type_traits>
+# define containerof(var, T, member) reinterpret_cast<std::conditional<std::is_const<std::remove_pointer<decltype(var)>::type>::value, std::add_const<T>::type, T>::type *>(reinterpret_cast<std::conditional<std::is_const<std::remove_pointer<decltype(var)>::type>::value, const char, char>::type *>(var) - offsetof(T, member))
# endif
# ifndef static_cast
# define static_cast(T, x) static_cast<T>(x)