00001 00002 /*============================================================================= 00003 physical quantities / units / constants 00004 Copyright (c) 2006, 2007 Martin Schulz 00005 http://physical.sourceforge.net 00006 00007 This is private code by Martin Schulz. 00008 00009 Use, modification and distribution is subject to the Boost Software 00010 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 00011 http://www.boost.org/LICENSE_1_0.txt) 00012 =============================================================================*/ 00013 00014 #ifndef PHYSICAL_LARGER_TYPE 00015 #define PHYSICAL_LARGER_TYPE 00016 00017 00018 namespace physical { 00019 00020 namespace detail { 00021 00022 // metafunction to choose the larger one of two types. Used here to find the appropriate 00023 // result type for operations on floats and doubles. 00024 template<typename T1, typename T2> 00025 struct larger_type { 00026 typedef typename boost::mpl::if_c< (sizeof(T1)>sizeof(T2)), T1, T2 >::type type; 00027 }; 00028 00029 // let's try it out: 00030 typedef larger_type<float, double>::type should_be_double; 00031 BOOST_STATIC_ASSERT(( boost::is_same< double, should_be_double >::value )); 00032 00033 00034 }; // namespace detail 00035 00036 }; // namespace physical 00037 00038 00039 #endif
Generated on Mon Apr 2 22:25:03 2007 for physical_svn by 1.5.1-p1 | hosted on |