is_dimensionless.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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) 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_IS_DIMENSIONLESS_HPP
  11. #define BOOST_UNITS_IS_DIMENSIONLESS_HPP
  12. ///
  13. /// \file
  14. /// \brief Check if a unit or quantity is dimensionless.
  15. ///
  16. #include <boost/mpl/bool.hpp>
  17. #include <boost/units/units_fwd.hpp>
  18. namespace boost {
  19. namespace units {
  20. template<class T>
  21. struct is_dimensionless :
  22. public mpl::false_
  23. { };
  24. /// Check if a unit is dimensionless.
  25. template<class System>
  26. struct is_dimensionless< unit<dimensionless_type,System> > :
  27. public mpl::true_
  28. { };
  29. /// Check if a quantity is dimensionless.
  30. template<class Unit,class Y>
  31. struct is_dimensionless< quantity<Unit,Y> > :
  32. public is_dimensionless<Unit>
  33. { };
  34. } // namespace units
  35. } // namespace boost
  36. #endif // BOOST_UNITS_IS_DIMENSIONLESS_HPP