get_system.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_GET_SYSTEM_HPP
  11. #define BOOST_UNITS_GET_SYSTEM_HPP
  12. /// \file
  13. /// \brief Get the system of a unit, absolute unit or quantity.
  14. #include <boost/units/units_fwd.hpp>
  15. namespace boost {
  16. namespace units {
  17. template<class T>
  18. struct get_system {};
  19. /// Get the system of a unit.
  20. template<class Dim,class System>
  21. struct get_system< unit<Dim,System> >
  22. {
  23. typedef System type;
  24. };
  25. /// Get the system of an absolute unit.
  26. template<class Unit>
  27. struct get_system< absolute<Unit> >
  28. {
  29. typedef typename get_system<Unit>::type type;
  30. };
  31. /// Get the system of a quantity.
  32. template<class Unit,class Y>
  33. struct get_system< quantity<Unit,Y> >
  34. {
  35. typedef typename get_system<Unit>::type type;
  36. };
  37. } // namespace units
  38. } // namespace boost
  39. #endif // BOOST_UNITS_GET_SYSTEM_HPP