summaryrefslogtreecommitdiff
path: root/boost/units/static_constant.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/units/static_constant.hpp')
-rw-r--r--boost/units/static_constant.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/boost/units/static_constant.hpp b/boost/units/static_constant.hpp
index 9026b3fde2..d3646adbda 100644
--- a/boost/units/static_constant.hpp
+++ b/boost/units/static_constant.hpp
@@ -13,9 +13,10 @@
#include <boost/units/config.hpp>
+#if defined(BOOST_NO_CXX11_CONSTEXPR) || defined(BOOST_UNITS_DOXYGEN)
/// A convenience macro that allows definition of static
/// constants in headers in an ODR-safe way.
-#define BOOST_UNITS_STATIC_CONSTANT(name, type) \
+# define BOOST_UNITS_STATIC_CONSTANT(name, type) \
template<bool b> \
struct name##_instance_t \
{ \
@@ -29,6 +30,10 @@ namespace \
\
template<bool b> \
const type name##_instance_t<b>::instance
+#else
+# define BOOST_UNITS_STATIC_CONSTANT(name, type) \
+BOOST_STATIC_CONSTEXPR type name
+#endif
/// A convenience macro for static constants with auto
/// type deduction.