Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:51:34

0001 #ifndef BOOST_QVM_DEDUCE_SCALAR_HPP_INCLUDED
0002 #define BOOST_QVM_DEDUCE_SCALAR_HPP_INCLUDED
0003 
0004 // Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc.
0005 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0006 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #include <boost/qvm/scalar_traits.hpp>
0009 #include <boost/qvm/static_assert.hpp>
0010 #include <boost/qvm/detail/remove_const.hpp>
0011 
0012 namespace boost { namespace qvm {
0013 
0014 namespace
0015 deduce_scalar_detail
0016     {
0017     template <class A,class B>
0018     struct
0019     deduce_scalar_impl
0020         {
0021         typedef void type;
0022         };
0023 
0024     template <class T>
0025     struct
0026     deduce_scalar_impl<T,T>
0027         {
0028         typedef T type;
0029         };
0030 
0031     template <> struct deduce_scalar_impl<signed char,unsigned char> { typedef unsigned char type; };
0032     template <> struct deduce_scalar_impl<signed char,unsigned short> { typedef unsigned short type; };
0033     template <> struct deduce_scalar_impl<signed char,unsigned int> { typedef unsigned int type; };
0034     template <> struct deduce_scalar_impl<signed char,unsigned long> { typedef unsigned long type; };
0035     template <> struct deduce_scalar_impl<signed char,signed short> { typedef signed short type; };
0036     template <> struct deduce_scalar_impl<signed char,signed int> { typedef signed int type; };
0037     template <> struct deduce_scalar_impl<signed char,signed long> { typedef signed long type; };
0038     template <> struct deduce_scalar_impl<signed char,float> { typedef float type; };
0039     template <> struct deduce_scalar_impl<signed char,double> { typedef double type; };
0040     template <> struct deduce_scalar_impl<unsigned char,unsigned short> { typedef unsigned short type; };
0041     template <> struct deduce_scalar_impl<unsigned char,unsigned int> { typedef unsigned int type; };
0042     template <> struct deduce_scalar_impl<unsigned char,unsigned long> { typedef unsigned long type; };
0043     template <> struct deduce_scalar_impl<unsigned char,signed short> { typedef signed short type; };
0044     template <> struct deduce_scalar_impl<unsigned char,signed int> { typedef signed int type; };
0045     template <> struct deduce_scalar_impl<unsigned char,signed long> { typedef signed long type; };
0046     template <> struct deduce_scalar_impl<unsigned char,float> { typedef float type; };
0047     template <> struct deduce_scalar_impl<unsigned char,double> { typedef double type; };
0048     template <> struct deduce_scalar_impl<signed short,unsigned short> { typedef unsigned short type; };
0049     template <> struct deduce_scalar_impl<signed short,unsigned int> { typedef unsigned int type; };
0050     template <> struct deduce_scalar_impl<signed short,unsigned long> { typedef unsigned long type; };
0051     template <> struct deduce_scalar_impl<signed short,signed int> { typedef signed int type; };
0052     template <> struct deduce_scalar_impl<signed short,signed long> { typedef signed long type; };
0053     template <> struct deduce_scalar_impl<signed short,float> { typedef float type; };
0054     template <> struct deduce_scalar_impl<signed short,double> { typedef double type; };
0055     template <> struct deduce_scalar_impl<unsigned short,unsigned int> { typedef unsigned int type; };
0056     template <> struct deduce_scalar_impl<unsigned short,unsigned long> { typedef unsigned long type; };
0057     template <> struct deduce_scalar_impl<unsigned short,signed int> { typedef signed int type; };
0058     template <> struct deduce_scalar_impl<unsigned short,signed long> { typedef signed long type; };
0059     template <> struct deduce_scalar_impl<unsigned short,float> { typedef float type; };
0060     template <> struct deduce_scalar_impl<unsigned short,double> { typedef double type; };
0061     template <> struct deduce_scalar_impl<signed int,unsigned int> { typedef unsigned int type; };
0062     template <> struct deduce_scalar_impl<signed int,unsigned long> { typedef unsigned long type; };
0063     template <> struct deduce_scalar_impl<signed int,signed long> { typedef signed long type; };
0064     template <> struct deduce_scalar_impl<signed int,float> { typedef float type; };
0065     template <> struct deduce_scalar_impl<signed int,double> { typedef double type; };
0066     template <> struct deduce_scalar_impl<unsigned int,unsigned long> { typedef unsigned long type; };
0067     template <> struct deduce_scalar_impl<unsigned int,signed long> { typedef signed long type; };
0068     template <> struct deduce_scalar_impl<unsigned int,float> { typedef float type; };
0069     template <> struct deduce_scalar_impl<unsigned int,double> { typedef double type; };
0070     template <> struct deduce_scalar_impl<signed long,unsigned long> { typedef unsigned long type; };
0071     template <> struct deduce_scalar_impl<signed long,float> { typedef float type; };
0072     template <> struct deduce_scalar_impl<signed long,double> { typedef double type; };
0073     template <> struct deduce_scalar_impl<unsigned long,float> { typedef float type; };
0074     template <> struct deduce_scalar_impl<unsigned long,double> { typedef double type; };
0075     template <> struct deduce_scalar_impl<float,double> { typedef double type; };
0076 
0077     template <> struct deduce_scalar_impl<unsigned char,signed char> { typedef unsigned char type; };
0078     template <> struct deduce_scalar_impl<unsigned short,signed char> { typedef unsigned short type; };
0079     template <> struct deduce_scalar_impl<unsigned int,signed char> { typedef unsigned int type; };
0080     template <> struct deduce_scalar_impl<unsigned long,signed char> { typedef unsigned long type; };
0081     template <> struct deduce_scalar_impl<signed short,signed char> { typedef signed short type; };
0082     template <> struct deduce_scalar_impl<signed int,signed char> { typedef signed int type; };
0083     template <> struct deduce_scalar_impl<signed long,signed char> { typedef signed long type; };
0084     template <> struct deduce_scalar_impl<float,signed char> { typedef float type; };
0085     template <> struct deduce_scalar_impl<double,signed char> { typedef double type; };
0086     template <> struct deduce_scalar_impl<unsigned short,unsigned char> { typedef unsigned short type; };
0087     template <> struct deduce_scalar_impl<unsigned int,unsigned char> { typedef unsigned int type; };
0088     template <> struct deduce_scalar_impl<unsigned long,unsigned char> { typedef unsigned long type; };
0089     template <> struct deduce_scalar_impl<signed short,unsigned char> { typedef signed short type; };
0090     template <> struct deduce_scalar_impl<signed int,unsigned char> { typedef signed int type; };
0091     template <> struct deduce_scalar_impl<signed long,unsigned char> { typedef signed long type; };
0092     template <> struct deduce_scalar_impl<float,unsigned char> { typedef float type; };
0093     template <> struct deduce_scalar_impl<double,unsigned char> { typedef double type; };
0094     template <> struct deduce_scalar_impl<unsigned short,signed short> { typedef unsigned short type; };
0095     template <> struct deduce_scalar_impl<unsigned int,signed short> { typedef unsigned int type; };
0096     template <> struct deduce_scalar_impl<unsigned long,signed short> { typedef unsigned long type; };
0097     template <> struct deduce_scalar_impl<signed int,signed short> { typedef signed int type; };
0098     template <> struct deduce_scalar_impl<signed long,signed short> { typedef signed long type; };
0099     template <> struct deduce_scalar_impl<float,signed short> { typedef float type; };
0100     template <> struct deduce_scalar_impl<double,signed short> { typedef double type; };
0101     template <> struct deduce_scalar_impl<unsigned int,unsigned short> { typedef unsigned int type; };
0102     template <> struct deduce_scalar_impl<unsigned long,unsigned short> { typedef unsigned long type; };
0103     template <> struct deduce_scalar_impl<signed int,unsigned short> { typedef signed int type; };
0104     template <> struct deduce_scalar_impl<signed long,unsigned short> { typedef signed long type; };
0105     template <> struct deduce_scalar_impl<float,unsigned short> { typedef float type; };
0106     template <> struct deduce_scalar_impl<double,unsigned short> { typedef double type; };
0107     template <> struct deduce_scalar_impl<unsigned int,signed int> { typedef unsigned int type; };
0108     template <> struct deduce_scalar_impl<unsigned long,signed int> { typedef unsigned long type; };
0109     template <> struct deduce_scalar_impl<signed long,signed int> { typedef signed long type; };
0110     template <> struct deduce_scalar_impl<float,signed int> { typedef float type; };
0111     template <> struct deduce_scalar_impl<double,signed int> { typedef double type; };
0112     template <> struct deduce_scalar_impl<unsigned long,unsigned int> { typedef unsigned long type; };
0113     template <> struct deduce_scalar_impl<signed long,unsigned int> { typedef signed long type; };
0114     template <> struct deduce_scalar_impl<float,unsigned int> { typedef float type; };
0115     template <> struct deduce_scalar_impl<double,unsigned int> { typedef double type; };
0116     template <> struct deduce_scalar_impl<unsigned long,signed long> { typedef unsigned long type; };
0117     template <> struct deduce_scalar_impl<float,signed long> { typedef float type; };
0118     template <> struct deduce_scalar_impl<double,signed long> { typedef double type; };
0119     template <> struct deduce_scalar_impl<float,unsigned long> { typedef float type; };
0120     template <> struct deduce_scalar_impl<double,unsigned long> { typedef double type; };
0121     template <> struct deduce_scalar_impl<double,float> { typedef double type; };
0122     }
0123 
0124 template <class A,class B>
0125 struct
0126 deduce_scalar
0127     {
0128     typedef typename deduce_scalar_detail::deduce_scalar_impl<typename qvm_detail::remove_const<A>::type,typename qvm_detail::remove_const<B>::type>::type type;
0129     };
0130 
0131 } }
0132 
0133 #endif