restrictors.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2010 NICTA and the authors listed below
00002 // http://nicta.com.au
00003 // 
00004 // Authors:
00005 // - Conrad Sanderson (conradsand at ieee dot org)
00006 // 
00007 // This file is part of the Armadillo C++ library.
00008 // It is provided without any warranty of fitness
00009 // for any purpose. You can redistribute this file
00010 // and/or modify it under the terms of the GNU
00011 // Lesser General Public License (LGPL) as published
00012 // by the Free Software Foundation, either version 3
00013 // of the License or (at your option) any later version.
00014 // (see http://www.opensource.org/licenses for more info)
00015 
00016 
00017 //! \addtogroup restrictors
00018 //! @{
00019 
00020 
00021 
00022 template<typename T> struct arma_scalar_only { };
00023 
00024 template<> struct arma_scalar_only<char>   { typedef char   result; };
00025 template<> struct arma_scalar_only<short>  { typedef short  result; };
00026 template<> struct arma_scalar_only<int>    { typedef int    result; };
00027 template<> struct arma_scalar_only<long>   { typedef long   result; };
00028 template<> struct arma_scalar_only<float>  { typedef float  result; };
00029 template<> struct arma_scalar_only<double> { typedef double result; };
00030 
00031 template<> struct arma_scalar_only<unsigned char>  { typedef unsigned char  result; };
00032 template<> struct arma_scalar_only<unsigned short> { typedef unsigned short result; };
00033 template<> struct arma_scalar_only<unsigned int>   { typedef unsigned int   result; };
00034 template<> struct arma_scalar_only<unsigned long>  { typedef unsigned long  result; };
00035 
00036 template<typename T> struct arma_scalar_only< std::complex<T> > { typedef std::complex<T> result; };
00037 
00038 
00039 
00040 template<typename T> struct arma_integral_only { };
00041 
00042 template<> struct arma_integral_only<char>   { typedef char   result; };
00043 template<> struct arma_integral_only<short>  { typedef short  result; };
00044 template<> struct arma_integral_only<int>    { typedef int    result; };
00045 template<> struct arma_integral_only<long>   { typedef long   result; };
00046 
00047 template<> struct arma_integral_only<unsigned char>  { typedef unsigned char  result; };
00048 template<> struct arma_integral_only<unsigned short> { typedef unsigned short result; };
00049 template<> struct arma_integral_only<unsigned int>   { typedef unsigned int   result; };
00050 template<> struct arma_integral_only<unsigned long>  { typedef unsigned long  result; };
00051 
00052 
00053 
00054 template<typename T> struct arma_unsigned_integral_only { };
00055 
00056 template<> struct arma_unsigned_integral_only<unsigned char>  { typedef unsigned char  result; };
00057 template<> struct arma_unsigned_integral_only<unsigned short> { typedef unsigned short result; };
00058 template<> struct arma_unsigned_integral_only<unsigned int>   { typedef unsigned int   result; };
00059 template<> struct arma_unsigned_integral_only<unsigned long>  { typedef unsigned long  result; };
00060 
00061 
00062 
00063 template<typename T> struct arma_signed_integral_only { };
00064 
00065 template<> struct arma_signed_integral_only<char>   { typedef char   result; };
00066 template<> struct arma_signed_integral_only<short>  { typedef short  result; };
00067 template<> struct arma_signed_integral_only<int>    { typedef int    result; };
00068 template<> struct arma_signed_integral_only<long>   { typedef long   result; };
00069 
00070 
00071 
00072 template<typename T> struct arma_float_only { };
00073 
00074 template<> struct arma_float_only<float>  { typedef float  result; };
00075 template<> struct arma_float_only<double> { typedef double result; };
00076 
00077 
00078 
00079 //! @}