// Copyright (C) 2010-2013 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup restrictors //! @{ // structures for template based restrictions of input/output arguments // (part of the SFINAE approach) // http://en.wikipedia.org/wiki/SFINAE template struct arma_scalar_only { }; template<> struct arma_scalar_only { typedef u8 result; }; template<> struct arma_scalar_only { typedef s8 result; }; template<> struct arma_scalar_only { typedef u16 result; }; template<> struct arma_scalar_only { typedef s16 result; }; template<> struct arma_scalar_only { typedef u32 result; }; template<> struct arma_scalar_only { typedef s32 result; }; #if defined(ARMA_USE_U64S64) template<> struct arma_scalar_only { typedef u64 result; }; template<> struct arma_scalar_only { typedef s64 result; }; #endif template<> struct arma_scalar_only { typedef float result; }; template<> struct arma_scalar_only { typedef double result; }; #if defined(ARMA_ALLOW_LONG) template<> struct arma_scalar_only { typedef ulng_t result; }; template<> struct arma_scalar_only { typedef slng_t result; }; #endif template struct arma_scalar_only< std::complex > { typedef std::complex result; }; template struct arma_integral_only { }; template<> struct arma_integral_only { typedef u8 result; }; template<> struct arma_integral_only { typedef s8 result; }; template<> struct arma_integral_only { typedef u16 result; }; template<> struct arma_integral_only { typedef s16 result; }; template<> struct arma_integral_only { typedef u32 result; }; template<> struct arma_integral_only { typedef s32 result; }; #if defined(ARMA_USE_U64S64) template<> struct arma_integral_only { typedef u64 result; }; template<> struct arma_integral_only { typedef s64 result; }; #endif #if defined(ARMA_ALLOW_LONG) template<> struct arma_integral_only { typedef ulng_t result; }; template<> struct arma_integral_only { typedef slng_t result; }; #endif template struct arma_unsigned_integral_only { }; template<> struct arma_unsigned_integral_only { typedef u8 result; }; template<> struct arma_unsigned_integral_only { typedef u16 result; }; template<> struct arma_unsigned_integral_only { typedef u32 result; }; #if defined(ARMA_USE_U64S64) template<> struct arma_unsigned_integral_only { typedef u64 result; }; #endif #if defined(ARMA_ALLOW_LONG) template<> struct arma_unsigned_integral_only { typedef ulng_t result; }; #endif template struct arma_signed_integral_only { }; template<> struct arma_signed_integral_only { typedef s8 result; }; template<> struct arma_signed_integral_only { typedef s16 result; }; template<> struct arma_signed_integral_only { typedef s32 result; }; #if defined(ARMA_USE_U64S64) template<> struct arma_signed_integral_only { typedef s64 result; }; #endif #if defined(ARMA_ALLOW_LONG) template<> struct arma_signed_integral_only { typedef slng_t result; }; #endif template struct arma_signed_only { }; template<> struct arma_signed_only { typedef s8 result; }; template<> struct arma_signed_only { typedef s16 result; }; template<> struct arma_signed_only { typedef s32 result; }; #if defined(ARMA_USE_U64S64) template<> struct arma_signed_only { typedef s64 result; }; #endif template<> struct arma_signed_only { typedef float result; }; template<> struct arma_signed_only { typedef double result; }; #if defined(ARMA_ALLOW_LONG) template<> struct arma_signed_only { typedef slng_t result; }; #endif template struct arma_signed_only< std::complex > { typedef std::complex result; }; template struct arma_real_only { }; template<> struct arma_real_only { typedef float result; }; template<> struct arma_real_only { typedef double result; }; template struct arma_real_or_cx_only { }; template<> struct arma_real_or_cx_only< float > { typedef float result; }; template<> struct arma_real_or_cx_only< double > { typedef double result; }; template<> struct arma_real_or_cx_only< std::complex > { typedef std::complex result; }; template<> struct arma_real_or_cx_only< std::complex > { typedef std::complex result; }; template struct arma_cx_only { }; template<> struct arma_cx_only< std::complex > { typedef std::complex result; }; template<> struct arma_cx_only< std::complex > { typedef std::complex result; }; template struct arma_not_cx { typedef T result; }; template struct arma_not_cx< std::complex > { }; template struct arma_blas_type_only { }; template<> struct arma_blas_type_only< float > { typedef float result; }; template<> struct arma_blas_type_only< double > { typedef double result; }; template<> struct arma_blas_type_only< std::complex > { typedef std::complex result; }; template<> struct arma_blas_type_only< std::complex > { typedef std::complex result; }; template struct arma_not_blas_type { typedef T result; }; template<> struct arma_not_blas_type< float > { }; template<> struct arma_not_blas_type< double > { }; template<> struct arma_not_blas_type< std::complex > { }; template<> struct arma_not_blas_type< std::complex > { }; template struct arma_op_rel_only { }; template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_eq > { typedef int result; }; template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result; }; template struct arma_not_op_rel { typedef int result; }; template<> struct arma_not_op_rel< op_rel_lt_pre > { }; template<> struct arma_not_op_rel< op_rel_lt_post > { }; template<> struct arma_not_op_rel< op_rel_gt_pre > { }; template<> struct arma_not_op_rel< op_rel_gt_post > { }; template<> struct arma_not_op_rel< op_rel_lteq_pre > { }; template<> struct arma_not_op_rel< op_rel_lteq_post > { }; template<> struct arma_not_op_rel< op_rel_gteq_pre > { }; template<> struct arma_not_op_rel< op_rel_gteq_post > { }; template<> struct arma_not_op_rel< op_rel_eq > { }; template<> struct arma_not_op_rel< op_rel_noteq > { }; template struct arma_glue_rel_only { }; template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_and > { typedef int result; }; template<> struct arma_glue_rel_only< glue_rel_or > { typedef int result; }; template struct arma_Mat_Col_Row_only { }; template struct arma_Mat_Col_Row_only< Mat > { typedef Mat result; }; template struct arma_Mat_Col_Row_only< Col > { typedef Col result; }; template struct arma_Mat_Col_Row_only< Row > { typedef Row result; }; template struct arma_Cube_only { }; template struct arma_Cube_only< Cube > { typedef Cube result; }; template struct arma_SpMat_SpCol_SpRow_only { }; template struct arma_SpMat_SpCol_SpRow_only< SpMat > { typedef SpMat result; }; template struct arma_SpMat_SpCol_SpRow_only< SpCol > { typedef SpCol result; }; template struct arma_SpMat_SpCol_SpRow_only< SpRow > { typedef SpRow result; }; template struct enable_if { }; template<> struct enable_if { typedef int result; }; template struct enable_if2 { }; template< typename result_type > struct enable_if2 { typedef result_type result; }; //! @}