From 222396759b88462e551543e3964bc1ffdf1faac3 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Tue, 9 Jul 2002 18:49:09 +0000 Subject: [PATCH] MWERKS bug workaround [SVN r14379] --- .../boost/python/detail/referent_storage.hpp | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/include/boost/python/detail/referent_storage.hpp b/include/boost/python/detail/referent_storage.hpp index 81ab33ea..aebacf64 100644 --- a/include/boost/python/detail/referent_storage.hpp +++ b/include/boost/python/detail/referent_storage.hpp @@ -6,9 +6,6 @@ #ifndef REFERENT_STORAGE_DWA200278_HPP # define REFERENT_STORAGE_DWA200278_HPP # include -# include -# include -# include # include namespace boost { namespace python { namespace detail { @@ -42,12 +39,35 @@ union aligned_storage # undef BOOST_PYTHON_ALIGNER + // Compute the size of T's referent. We wouldn't need this at all, + // but sizeof() is broken in CodeWarriors <= 8.0 + template struct referent_size; + +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct referent_size + { + BOOST_STATIC_CONSTANT( + std::size_t, value = sizeof(T)); + }; + +# else + + template struct referent_size + { + static T f(); + BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(f())); + }; + +# endif + // A metafunction returning a POD type which can store U, where T == // U&. If T is not a reference type, returns a POD which can store T. template struct referent_storage { - typedef aligned_storage type; + typedef aligned_storage::value> type; }; }}} // namespace boost::python::detail