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