From a060e77f104935f00a135ba81388e16b55d9f05c Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Mon, 2 Aug 2004 19:37:24 +0000 Subject: [PATCH] added an experimental promote_type_multiplies svn path=/trunk/boost/boost/numeric/ublas/; revision=24250 --- include/boost/numeric/ublas/traits.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index 931b731d..f0d9566a 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -963,6 +963,24 @@ namespace boost { namespace numeric { namespace ublas { typename base_type::types, index>::type id; typedef typename id::type promote_type; }; + template + struct promote_type_multiplies { + typedef type_deduction_detail::base_result_of base_type; + static typename base_type::x_type x; + static typename base_type::y_type y; + BOOST_STATIC_CONSTANT(int, + size = sizeof( + type_deduction_detail::test< + typename base_type::x_type + , typename base_type::y_type + >(x * y) // Specifically the * arithmetic actions + )); + + BOOST_STATIC_CONSTANT(int, index = (size / sizeof(char)) - 1); + typedef typename mpl::at_c< + typename base_type::types, index>::type id; + typedef typename id::type promote_type; + }; #else