GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::remove_pointer(3) C++ Standard Libary std::remove_pointer(3)

std::remove_pointer - std::remove_pointer


Defined in header <type_traits>
template< class T > (since C++11)
struct remove_pointer;


Provides the member typedef type which is the type pointed to by T, or, if T is not
a pointer, then type is the same as T.


The behavior of a program that adds specializations for remove_pointer is undefined.


Name Definition
type the type pointed to by T or T if it's not a pointer


template< class T > (since C++14)
using remove_pointer_t = typename remove_pointer<T>::type;


template< class T > struct remove_pointer {typedef T type;};
template< class T > struct remove_pointer<T*> {typedef T type;};
template< class T > struct remove_pointer<T* const> {typedef T type;};
template< class T > struct remove_pointer<T* volatile> {typedef T type;};
template< class T > struct remove_pointer<T* const volatile> {typedef T type;};

// Run this code


#include <iostream>
#include <type_traits>


template<class T1, class T2>
void print_is_same()
{
std::cout << std::is_same<T1, T2>() << '\n';
}


void print_separator()
{
std::cout << "-----\n";
}


int main()
{
std::cout << std::boolalpha;


print_is_same<int, int>(); // true
print_is_same<int, int*>(); // false
print_is_same<int, int**>(); // false


print_separator();


print_is_same<int, std::remove_pointer<int>::type>(); // true
print_is_same<int, std::remove_pointer<int*>::type>(); // true
print_is_same<int, std::remove_pointer<int**>::type>(); // false


print_separator();


print_is_same<int, std::remove_pointer<int* const>::type>(); // true
print_is_same<int, std::remove_pointer<int* volatile>::type>(); // true
print_is_same<int, std::remove_pointer<int* const volatile>::type>(); // true
}


true
false
false
-----
true
true
false
-----
true
true
true


is_pointer checks if a type is a pointer type
(C++11) (class template)
add_pointer adds a pointer to the given type
(C++11) (class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.