From 5c9af39cfd345fffa826958615fd7c16f630bf52 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 7 Jan 2019 18:46:47 +0000 Subject: Gem 8d663a43c3a8c10e7ed7666131fa412a4db6bb32 linux/amd64 built 'master:8d663a43c3a8c10e7ed7666131fa412a4db6bb32' for linux/amd64 --- Gem/develop/include/Gem/Gem/State.h | 4 ++-- Gem/develop/include/Gem/Utils/any.h | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'Gem/develop/include') diff --git a/Gem/develop/include/Gem/Gem/State.h b/Gem/develop/include/Gem/Gem/State.h index b09ace4..173acf9 100644 --- a/Gem/develop/include/Gem/Gem/State.h +++ b/Gem/develop/include/Gem/Gem/State.h @@ -61,8 +61,8 @@ public: typedef enum { _ILLEGAL=-1, _DIRTY, /* "dirty" */ - _TIMING_TICK, /* "timing.tick" */ - _PIX, /* "pix" */ + _TIMING_TICK, /* "timing.tick" */ + _PIX, /* "pix", <*pixBuffer> */ _GL_STACKS, /* "stacks" */ _GL_DISPLAYLIST, /* */ _GL_LIGHTING, /* */ diff --git a/Gem/develop/include/Gem/Utils/any.h b/Gem/develop/include/Gem/Utils/any.h index 5841c79..0861e19 100644 --- a/Gem/develop/include/Gem/Utils/any.h +++ b/Gem/develop/include/Gem/Utils/any.h @@ -27,6 +27,7 @@ #include #include +//#define GEM_ANY_TYPEID_HACK namespace gem { @@ -70,7 +71,7 @@ struct fxns { struct type { static const std::type_info& get_type(void) { -#if 0 +#if GEM_ANY_TYPEID_HACK const std::type_info&res=typeid(T); // the following is a dummy use of the type_info struct // to make the template engine work properly on OSX/10.9 @@ -104,7 +105,7 @@ struct fxns { struct type { static const std::type_info& get_type(void) { -#if 0 +#if GEM_ANY_TYPEID_HACK const std::type_info&res=typeid(T); return res; #else @@ -353,6 +354,34 @@ T const& any_cast(any const& this_) { return *any_cast(const_cast(&this_)); } +#ifdef GEM_INTERNAL +// Note: The "unsafe" versions of any_cast are not part of the +// public interface (and hence protected by GEM_INTERNAL) and may +// be removed at any time. They are required where we know what type +// is stored in the any and can't use typeid() comparison, e.g., +// when our types may travel across different shared libraries. +template +T* unsafe_any_cast(any* this_) +{ + if (sizeof(T) <= sizeof(void*)) { + return reinterpret_cast(&this_->object); + } else { + return reinterpret_cast(this_->object); + } +} + +template +T const* unsafe_any_cast(any const* this_) +{ + return unsafe_any_cast(const_cast(this_)); +} + +template +T const& unsafe_any_cast(any const& this_) +{ + return *unsafe_any_cast(const_cast(&this_)); +} +#endif } #ifdef _MSC_VER -- cgit v1.2.1