Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:03

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