is_reference — Klasa
Sprawdza, czy typ to odwołanie.
template<class Ty>
struct is_reference;
Parametry
- Ty
Typ do zapytania.
Uwagi
Wystąpienie typu predykatu ma wartość true, jeśli typ Ty jest odwołaniem do obiektu lub do funkcji, w przeciwnym razie przechowuje wartość false.
Przykład
// std__type_traits__is_reference.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_reference<trivial> == " << std::boolalpha
<< std::is_reference<trivial>::value << std::endl;
std::cout << "is_reference<trivial&> == " << std::boolalpha
<< std::is_reference<trivial&>::value << std::endl;
std::cout << "is_reference<int()> == " << std::boolalpha
<< std::is_reference<int()>::value << std::endl;
std::cout << "is_reference<int(&)()> == " << std::boolalpha
<< std::is_reference<int(&)()>::value << std::endl;
return (0);
}
Wymagania
Nagłówek: <type_traits>
Przestrzeń nazw: std