is_void Class

Tests if type is void.

template<class Ty>
    struct is_void;

Parameters

  • Ty
    The type to query.

Remarks

An instance of the type predicate holds true if the type Ty is void or a cv-qualified form of void, otherwise it holds false.

Example

 

// std_tr1__type_traits__is_void.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "is_void<trivial> == " << std::boolalpha 
        << std::is_void<trivial>::value << std::endl; 
    std::cout << "is_void<void()> == " << std::boolalpha 
        << std::is_void<void()>::value << std::endl; 
    std::cout << "is_void<void> == " << std::boolalpha 
        << std::is_void<void>::value << std::endl; 
 
    return (0); 
    } 
 
is_void<trivial> == false
is_void<void()> == false
is_void<void> == true

Requirements

Header: <type_traits>

Namespace: std

See Also

Reference

<type_traits>

Other Resources

<type_traits> Members