max@0: // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2010-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup restrictors max@0: //! @{ max@0: max@0: max@0: max@0: // structures for template based restrictions of input/output arguments max@0: // (part of the SFINAE approach) max@0: // http://en.wikipedia.org/wiki/SFINAE max@0: max@0: max@0: template struct arma_scalar_only { }; max@0: max@0: template<> struct arma_scalar_only { typedef u8 result; }; max@0: template<> struct arma_scalar_only { typedef s8 result; }; max@0: template<> struct arma_scalar_only { typedef u16 result; }; max@0: template<> struct arma_scalar_only { typedef s16 result; }; max@0: template<> struct arma_scalar_only { typedef u32 result; }; max@0: template<> struct arma_scalar_only { typedef s32 result; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct arma_scalar_only { typedef u64 result; }; max@0: template<> struct arma_scalar_only { typedef s64 result; }; max@0: #endif max@0: template<> struct arma_scalar_only { typedef float result; }; max@0: template<> struct arma_scalar_only { typedef double result; }; max@0: max@0: max@0: template max@0: struct arma_scalar_only< std::complex > { typedef std::complex result; }; max@0: max@0: max@0: max@0: template struct arma_integral_only { }; max@0: max@0: template<> struct arma_integral_only { typedef u8 result; }; max@0: template<> struct arma_integral_only { typedef s8 result; }; max@0: template<> struct arma_integral_only { typedef u16 result; }; max@0: template<> struct arma_integral_only { typedef s16 result; }; max@0: template<> struct arma_integral_only { typedef u32 result; }; max@0: template<> struct arma_integral_only { typedef s32 result; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct arma_integral_only { typedef u64 result; }; max@0: template<> struct arma_integral_only { typedef s64 result; }; max@0: #endif max@0: max@0: max@0: max@0: template struct arma_unsigned_integral_only { }; max@0: max@0: template<> struct arma_unsigned_integral_only { typedef u8 result; }; max@0: template<> struct arma_unsigned_integral_only { typedef u16 result; }; max@0: template<> struct arma_unsigned_integral_only { typedef u32 result; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct arma_unsigned_integral_only { typedef u64 result; }; max@0: #endif max@0: max@0: max@0: max@0: template struct arma_signed_integral_only { }; max@0: max@0: template<> struct arma_signed_integral_only { typedef s8 result; }; max@0: template<> struct arma_signed_integral_only { typedef s16 result; }; max@0: template<> struct arma_signed_integral_only { typedef s32 result; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct arma_signed_integral_only { typedef s64 result; }; max@0: #endif max@0: max@0: max@0: max@0: template struct arma_signed_only { }; max@0: max@0: template<> struct arma_signed_only { typedef s8 result; }; max@0: template<> struct arma_signed_only { typedef s16 result; }; max@0: template<> struct arma_signed_only { typedef s32 result; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct arma_signed_only { typedef s64 result; }; max@0: #endif max@0: template<> struct arma_signed_only { typedef float result; }; max@0: template<> struct arma_signed_only { typedef double result; }; max@0: max@0: template struct arma_signed_only< std::complex > { typedef std::complex result; }; max@0: max@0: max@0: max@0: template struct arma_float_only { }; max@0: max@0: template<> struct arma_float_only { typedef float result; }; max@0: template<> struct arma_float_only { typedef double result; }; max@0: max@0: max@0: max@0: template struct arma_float_or_cx_only { }; max@0: max@0: template<> struct arma_float_or_cx_only< float > { typedef float result; }; max@0: template<> struct arma_float_or_cx_only< double > { typedef double result; }; max@0: template<> struct arma_float_or_cx_only< std::complex > { typedef std::complex result; }; max@0: template<> struct arma_float_or_cx_only< std::complex > { typedef std::complex result; }; max@0: max@0: max@0: max@0: template struct arma_cx_only { }; max@0: max@0: template<> struct arma_cx_only< std::complex > { typedef std::complex result; }; max@0: template<> struct arma_cx_only< std::complex > { typedef std::complex result; }; max@0: max@0: max@0: max@0: template struct arma_not_cx { typedef T result; }; max@0: template struct arma_not_cx< std::complex > { }; max@0: max@0: max@0: max@0: template struct arma_blas_type_only { }; max@0: max@0: template<> struct arma_blas_type_only< float > { typedef float result; }; max@0: template<> struct arma_blas_type_only< double > { typedef double result; }; max@0: template<> struct arma_blas_type_only< std::complex > { typedef std::complex result; }; max@0: template<> struct arma_blas_type_only< std::complex > { typedef std::complex result; }; max@0: max@0: max@0: max@0: template struct arma_op_rel_only { }; max@0: max@0: template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_eq > { typedef int result; }; max@0: template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result; }; max@0: max@0: max@0: max@0: template struct arma_not_op_rel { typedef int result; }; max@0: max@0: template<> struct arma_not_op_rel< op_rel_lt_pre > { }; max@0: template<> struct arma_not_op_rel< op_rel_lt_post > { }; max@0: template<> struct arma_not_op_rel< op_rel_gt_pre > { }; max@0: template<> struct arma_not_op_rel< op_rel_gt_post > { }; max@0: template<> struct arma_not_op_rel< op_rel_lteq_pre > { }; max@0: template<> struct arma_not_op_rel< op_rel_lteq_post > { }; max@0: template<> struct arma_not_op_rel< op_rel_gteq_pre > { }; max@0: template<> struct arma_not_op_rel< op_rel_gteq_post > { }; max@0: template<> struct arma_not_op_rel< op_rel_eq > { }; max@0: template<> struct arma_not_op_rel< op_rel_noteq > { }; max@0: max@0: max@0: max@0: template struct arma_glue_rel_only { }; max@0: max@0: template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result; }; max@0: template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result; }; max@0: template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result; }; max@0: template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result; }; max@0: template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result; }; max@0: template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result; }; max@0: max@0: max@0: max@0: template struct arma_Mat_Col_Row_only { }; max@0: max@0: template struct arma_Mat_Col_Row_only< Mat > { typedef Mat result; }; max@0: template struct arma_Mat_Col_Row_only< Col > { typedef Col result; }; max@0: template struct arma_Mat_Col_Row_only< Row > { typedef Row result; }; max@0: max@0: max@0: max@0: template struct arma_Cube_only { }; max@0: template struct arma_Cube_only< Cube > { typedef Cube result; }; max@0: max@0: max@0: max@0: //! @}