annotate DEPENDENCIES/generic/include/boost/units/static_constant.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
Chris@16 2 // unit/quantity manipulation and conversion
Chris@16 3 //
Chris@16 4 // Copyright (C) 2003-2008 Matthias Christian Schabel
Chris@16 5 // Copyright (C) 2008 Steven Watanabe
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 8 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10
Chris@16 11 #ifndef BOOST_UNITS_STATIC_CONSTANT_HPP
Chris@16 12 #define BOOST_UNITS_STATIC_CONSTANT_HPP
Chris@16 13
Chris@16 14 #include <boost/units/config.hpp>
Chris@16 15
Chris@16 16 /// A convenience macro that allows definition of static
Chris@16 17 /// constants in headers in an ODR-safe way.
Chris@16 18 #define BOOST_UNITS_STATIC_CONSTANT(name, type) \
Chris@16 19 template<bool b> \
Chris@16 20 struct name##_instance_t \
Chris@16 21 { \
Chris@16 22 static const type instance; \
Chris@16 23 }; \
Chris@16 24 \
Chris@16 25 namespace \
Chris@16 26 { \
Chris@16 27 static const type& name = name##_instance_t<true>::instance; \
Chris@16 28 } \
Chris@16 29 \
Chris@16 30 template<bool b> \
Chris@16 31 const type name##_instance_t<b>::instance
Chris@16 32
Chris@16 33 /// A convenience macro for static constants with auto
Chris@16 34 /// type deduction.
Chris@16 35 #if BOOST_UNITS_HAS_TYPEOF
Chris@16 36
Chris@16 37 #if BOOST_UNITS_HAS_BOOST_TYPEOF
Chris@16 38
Chris@16 39 #define BOOST_UNITS_AUTO_STATIC_CONSTANT(name, value) \
Chris@16 40 BOOST_TYPEOF_NESTED_TYPEDEF(name##_nested_t, value) \
Chris@16 41 BOOST_UNITS_STATIC_CONSTANT(name, name##_nested_t::type) = (value)
Chris@16 42
Chris@16 43 #elif BOOST_UNITS_HAS_MWERKS_TYPEOF
Chris@16 44
Chris@16 45 #define BOOST_UNITS_AUTO_STATIC_CONSTANT(name, value) \
Chris@16 46 BOOST_UNITS_STATIC_CONSTANT(name, __typeof__(value)) = (value)
Chris@16 47
Chris@16 48 #elif BOOST_UNITS_HAS_GNU_TYPEOF
Chris@16 49
Chris@16 50 #define BOOST_UNITS_AUTO_STATIC_CONSTANT(name, value) \
Chris@16 51 BOOST_UNITS_STATIC_CONSTANT(name, typeof(value)) = (value)
Chris@16 52
Chris@16 53 #endif // BOOST_UNITS_HAS_BOOST_TYPEOF
Chris@16 54
Chris@16 55 #endif // BOOST_UNITS_HAS_TYPEOF
Chris@16 56
Chris@16 57 #endif // BOOST_UNITS_STATIC_CONSTANT_HPP