123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #ifndef BOOST_UNITS_DIMENSION_HPP
- #define BOOST_UNITS_DIMENSION_HPP
- #include <boost/static_assert.hpp>
- #include <boost/type_traits/is_same.hpp>
- #include <boost/mpl/arithmetic.hpp>
- #include <boost/units/static_rational.hpp>
- #include <boost/units/detail/dimension_list.hpp>
- #include <boost/units/detail/dimension_impl.hpp>
- namespace boost {
- namespace units {
- template<typename Seq>
- struct make_dimension_list
- {
- typedef typename detail::sort_dims<Seq>::type type;
- };
- template<typename DL,typename Ex>
- struct static_power
- {
- typedef typename detail::static_power_impl<DL::size::value>::template apply<
- DL,
- Ex
- >::type type;
- };
- template<typename DL,typename Rt>
- struct static_root
- {
- typedef typename detail::static_root_impl<DL::size::value>::template apply<
- DL,
- Rt
- >::type type;
- };
- }
- #ifndef BOOST_UNITS_DOXYGEN
- namespace mpl {
- template<>
- struct plus_impl<boost::units::detail::dimension_list_tag,boost::units::detail::dimension_list_tag>
- {
- template<class T0, class T1>
- struct apply
- {
- BOOST_STATIC_ASSERT((boost::is_same<T0,T1>::value == true));
- typedef T0 type;
- };
- };
- template<>
- struct minus_impl<boost::units::detail::dimension_list_tag,boost::units::detail::dimension_list_tag>
- {
- template<class T0, class T1>
- struct apply
- {
- BOOST_STATIC_ASSERT((boost::is_same<T0,T1>::value == true));
- typedef T0 type;
- };
- };
- template<>
- struct times_impl<boost::units::detail::dimension_list_tag,boost::units::detail::dimension_list_tag>
- {
- template<class T0, class T1>
- struct apply
- {
- typedef typename boost::units::detail::merge_dimensions<T0,T1>::type type;
- };
- };
- template<>
- struct divides_impl<boost::units::detail::dimension_list_tag,boost::units::detail::dimension_list_tag>
- {
- template<class T0, class T1>
- struct apply
- {
- typedef typename boost::units::detail::merge_dimensions<
- T0,
- typename boost::units::detail::static_inverse_impl<
- T1::size::value
- >::template apply<
- T1
- >::type
- >::type type;
- };
- };
- template<>
- struct negate_impl<boost::units::detail::dimension_list_tag>
- {
- template<class T0>
- struct apply
- {
- typedef T0 type;
- };
- };
- }
- #endif
- }
- #endif
|