// 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) 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) /** \file \brief dimension.cpp \detailed Test dimension list manipulation. Output: @verbatim //[dimension_output length_dimension = list >, dimensionless_type> mass_dimension = list >, dimensionless_type> time_dimension = list >, dimensionless_type> energy_dimension = list >, list >, list >, dimensionless_type> > > LM_type = list >, list >, dimensionless_type> > L_T_type = list >, list >, dimensionless_type> > V_type = list >, list >, dimensionless_type> > //] @endverbatim **/ #include #include #include #include #include "test_system.hpp" namespace mpl = boost::mpl; int main(void) { using namespace boost::units; BOOST_MPL_ASSERT((boost::is_same< length_dimension, mpl::push_front< dimensionless_type, dim > >::type >)); BOOST_MPL_ASSERT((boost::is_same< mass_dimension, mpl::push_front< dimensionless_type, dim > >::type >)); BOOST_MPL_ASSERT((boost::is_same > >::type, dim > >::type, dim > >::type>)); std::cout << "length_dimension = " << simplify_typename(length_dimension()) << std::endl << "mass_dimension = " << simplify_typename(mass_dimension()) << std::endl << "time_dimension = " << simplify_typename(time_dimension()) << std::endl << "energy_dimension = " << simplify_typename(energy_dimension()) << std::endl; //[dimension_snippet_1 typedef mpl::times::type LM_type; typedef mpl::divides::type L_T_type; typedef static_root< mpl::divides::type, static_rational<2> >::type V_type; //] BOOST_MPL_ASSERT((boost::is_same > >::type, dim > >::type>)); BOOST_MPL_ASSERT((boost::is_same > >::type, dim > >::type>)); BOOST_MPL_ASSERT((boost::is_same > >::type, dim > >::type>)); std::cout << "LM_type = " << simplify_typename(LM_type()) << std::endl << "L_T_type = " << simplify_typename(L_T_type()) << std::endl << "V_type = " << simplify_typename(V_type()) << std::endl; return 0; }