From 0f89a54d5eb96ba655f42b49949b2916cbe54f51 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 11 Feb 2001 19:29:01 +0000 Subject: [PATCH] Added BOOST_STATIC_CONSTANT [SVN r9126] --- include/boost/config.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/config.hpp b/include/boost/config.hpp index 9f4a304e..2c6f46f6 100644 --- a/include/boost/config.hpp +++ b/include/boost/config.hpp @@ -11,6 +11,7 @@ // http://www.boost.org/libs/config // Revision History (excluding minor changes for specific compilers) +// 11 Feb 01 Added BOOST_STATIC_CONSTANT (Dave Abrahams) // 20 Jan 01 BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS moved here from // cast.hpp. Added missing BOOST_NO_STRINGSTREAM which some // boost code seemed to depend on. (Dave Abrahams) @@ -503,6 +504,17 @@ namespace std { } #endif +// BOOST_STATIC_CONSTANT workaround --------------------------------------- // +// On compilers which don't allow in-class initialization of static integral +// constant members, we must use enums as a workaround if we want the constants +// to be available at compile-time. This macro gives us a convenient way to +// declare such constants. +#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } +#else +# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment +#endif + #endif // BOOST_CONFIG_HPP