1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
2 // unit/quantity manipulation and conversion
4 // Copyright (C) 2003-2008 Matthias Christian Schabel
5 // Copyright (C) 2008 Steven Watanabe
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)
11 #ifndef BOOST_UNITS_DETAIL_ONE_HPP
12 #define BOOST_UNITS_DETAIL_ONE_HPP
14 #include <boost/units/operators.hpp>
20 struct one { one() {} };
22 // workaround for pathscale.
23 inline one make_one() {
29 struct multiply_typeof_helper<one, T>
35 struct multiply_typeof_helper<T, one>
41 struct multiply_typeof_helper<one, one>
47 inline T operator*(const one&, const T& t)
53 inline T operator*(const T& t, const one&)
58 inline one operator*(const one&, const one&)
65 struct divide_typeof_helper<T, one>
71 struct divide_typeof_helper<one, T>
77 struct divide_typeof_helper<one, one>
83 inline T operator/(const T& t, const one&)
89 inline T operator/(const one&, const T& t)
94 inline one operator/(const one&, const one&)
101 inline bool operator>(const boost::units::one&, const T& t) {
106 T one_to_double(const T& t) { return t; }
108 inline double one_to_double(const one&) { return 1.0; }
111 struct one_to_double_type { typedef T type; };
114 struct one_to_double_type<one> { typedef double type; };