prevent_redefinition.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP
  11. #define BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP
  12. #include <boost/mpl/long.hpp>
  13. namespace boost {
  14. namespace units {
  15. namespace detail {
  16. struct no { BOOST_CONSTEXPR no() : dummy() {} char dummy; };
  17. struct yes { no dummy[2]; };
  18. template<bool> struct ordinal_has_already_been_defined;
  19. template<>
  20. struct ordinal_has_already_been_defined<true> { };
  21. template<>
  22. struct ordinal_has_already_been_defined<false> { typedef void type; };
  23. }
  24. /// This must be in namespace boost::units so that ADL
  25. /// will work. we need a mangled name because it must
  26. /// be found by ADL
  27. /// INTERNAL ONLY
  28. template<class T>
  29. BOOST_CONSTEXPR
  30. detail::no
  31. boost_units_is_registered(const T&)
  32. { return(detail::no()); }
  33. /// INTERNAL ONLY
  34. template<class T>
  35. BOOST_CONSTEXPR
  36. detail::no
  37. boost_units_unit_is_registered(const T&)
  38. { return(detail::no()); }
  39. } // namespace units
  40. } // namespace boost
  41. #endif // BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP