1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and 2 // unit/quantity manipulation and conversion 3 // 4 // Copyright (C) 2003-2008 Matthias Christian Schabel 5 // Copyright (C) 2007-2008 Steven Watanabe 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See 8 // accompanying file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt) 10 11 #ifndef BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP 12 #define BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP 13 14 #include <boost/mpl/long.hpp> 15 16 namespace boost { 17 18 namespace units { 19 20 namespace detail { 21 noboost::units::detail::no22struct no { BOOST_CONSTEXPR no() : dummy() {} char dummy; }; 23 struct yes { no dummy[2]; }; 24 25 template<bool> struct ordinal_has_already_been_defined; 26 27 template<> 28 struct ordinal_has_already_been_defined<true> { }; 29 30 template<> 31 struct ordinal_has_already_been_defined<false> { typedef void type; }; 32 33 } 34 35 /// This must be in namespace boost::units so that ADL 36 /// will work. we need a mangled name because it must 37 /// be found by ADL 38 /// INTERNAL ONLY 39 template<class T> 40 BOOST_CONSTEXPR 41 detail::no boost_units_is_registered(const T &)42boost_units_is_registered(const T&) 43 { return(detail::no()); } 44 45 /// INTERNAL ONLY 46 template<class T> 47 BOOST_CONSTEXPR 48 detail::no boost_units_unit_is_registered(const T &)49boost_units_unit_is_registered(const T&) 50 { return(detail::no()); } 51 52 } // namespace units 53 54 } // namespace boost 55 56 #endif // BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP 57