Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 1.55 KB

is-arithmetic-class.md

File metadata and controls

71 lines (53 loc) · 1.55 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: is_arithmetic Class
is_arithmetic Class
11/04/2016
type_traits/std::is_arithmetic
is_arithmetic class
is_arithmetic
ea427b7e-0141-4a04-848f-561054c53001

is_arithmetic Class

Tests if type is arithmetic.

Syntax

template <class Ty>
struct is_arithmetic;

Parameters

Ty
The type to query.

Remarks

An instance of the type predicate holds true if the type Ty is an arithmetic type, that is, an integral type or a floating point type, or a cv-qualified form of one of them, otherwise it holds false.

Example

// std__type_traits__is_arithmetic.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>

struct trivial
    {
    int val;
    };

int main()
    {
    std::cout << "is_arithmetic<trivial> == " << std::boolalpha
        << std::is_arithmetic<trivial>::value << std::endl;
    std::cout << "is_arithmetic<int> == " << std::boolalpha
        << std::is_arithmetic<int>::value << std::endl;
    std::cout << "is_arithmetic<float> == " << std::boolalpha
        << std::is_arithmetic<float>::value << std::endl;

    return (0);
    }
is_arithmetic<trivial> == false
is_arithmetic<int> == true
is_arithmetic<float> == true

Requirements

Header: <type_traits>

Namespace: std

See also

<type_traits>
is_floating_point Class
is_integral Class