/usr/include/boost/units/detail/unscale.hpp is in libboost1.54-dev 1.54.0-4ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | // Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2007-2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
#define BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
#include <string>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/times.hpp>
#include <boost/mpl/negate.hpp>
#include <boost/mpl/less.hpp>
#include <boost/units/config.hpp>
#include <boost/units/dimension.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/one.hpp>
namespace boost {
namespace units {
template<class T>
struct heterogeneous_system;
template<class T, class D, class Scale>
struct heterogeneous_system_impl;
template<class T, class E>
struct heterogeneous_system_dim;
template<class S, class Scale>
struct scaled_base_unit;
/// removes all scaling from a unit or a base unit.
template<class T>
struct unscale
{
#ifndef BOOST_UNITS_DOXYGEN
typedef T type;
#else
typedef detail::unspecified type;
#endif
};
/// INTERNAL ONLY
template<class S, class Scale>
struct unscale<scaled_base_unit<S, Scale> >
{
typedef typename unscale<S>::type type;
};
/// INTERNAL ONLY
template<class D, class S>
struct unscale<unit<D, S> >
{
typedef unit<D, typename unscale<S>::type> type;
};
/// INTERNAL ONLY
template<class Scale>
struct scale_list_dim;
/// INTERNAL ONLY
template<class T>
struct get_scale_list
{
typedef dimensionless_type type;
};
/// INTERNAL ONLY
template<class S, class Scale>
struct get_scale_list<scaled_base_unit<S, Scale> >
{
typedef typename mpl::times<list<scale_list_dim<Scale>, dimensionless_type>, typename get_scale_list<S>::type>::type type;
};
/// INTERNAL ONLY
template<class D, class S>
struct get_scale_list<unit<D, S> >
{
typedef typename get_scale_list<S>::type type;
};
/// INTERNAL ONLY
struct scale_dim_tag {};
/// INTERNAL ONLY
template<class Scale>
struct scale_list_dim : Scale
{
typedef scale_dim_tag tag;
typedef scale_list_dim type;
};
} // namespace units
#ifndef BOOST_UNITS_DOXYGEN
namespace mpl {
/// INTERNAL ONLY
template<>
struct less_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
{
template<class T0, class T1>
struct apply : mpl::bool_<((T0::base) < (T1::base))> {};
};
}
#endif
namespace units {
namespace detail {
template<class Scale>
struct is_empty_dim<scale_list_dim<Scale> > : mpl::false_ {};
template<long N>
struct is_empty_dim<scale_list_dim<scale<N, static_rational<0, 1> > > > : mpl::true_ {};
template<int N>
struct eval_scale_list_impl
{
template<class Begin>
struct apply
{
typedef typename eval_scale_list_impl<N-1>::template apply<typename Begin::next> next_iteration;
typedef typename multiply_typeof_helper<typename next_iteration::type, typename Begin::item::value_type>::type type;
static type value()
{
return(next_iteration::value() * Begin::item::value());
}
};
};
template<>
struct eval_scale_list_impl<0>
{
template<class Begin>
struct apply
{
typedef one type;
static one value()
{
one result;
return(result);
}
};
};
}
/// INTERNAL ONLY
template<class T>
struct eval_scale_list : detail::eval_scale_list_impl<T::size::value>::template apply<T> {};
} // namespace units
#ifndef BOOST_UNITS_DOXYGEN
namespace mpl {
/// INTERNAL ONLY
template<>
struct plus_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
{
template<class T0, class T1>
struct apply
{
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
typename mpl::plus<typename T0::exponent, typename T1::exponent>::type
>
> type;
};
};
/// INTERNAL ONLY
template<>
struct negate_impl<boost::units::scale_dim_tag>
{
template<class T0>
struct apply
{
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
typename mpl::negate<typename T0::exponent>::type
>
> type;
};
};
/// INTERNAL ONLY
template<>
struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag>
{
template<class T0, class T1>
struct apply
{
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
typename mpl::times<typename T0::exponent, T1>::type
>
> type;
};
};
} // namespace mpl
#endif
} // namespace boost
#endif
|