std::make_signed in C++ with Examples Last Updated : 08 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The std::make_signed template of C++ STL is present in the <type_traits> header file. The std::make_signed template of C++ STL is used to get the signed type corresponding to T(Triat class), by keeping any cv-qualifiers. It can be checked using std::is_same::value function whether the given type T is signed type or not. Header File: #include<type_traits> Template Class: template< class T > struct make_signed; template<class T> using make_signed_t = typename make_signed<T>::type; Syntax: std::make_signed<T>::type Parameter: The template std::make_signed accepts a single parameter T(Trait class) and maked the type T as a signed type. Below is the program to demonstrate std::make_signed in C++: Program: CPP // C++ program to illustrate // std::make_signed // make_signed #include <iostream> #include <type_traits> using namespace std; // Declare enum enum ENUM1 { a, b, c }; enum class ENUM2 : unsigned char { x, y, z }; // Driver Code int main() { // Declare variable using make_signed // for int, unsigned, const unsigned, // enum1 and enum2 typedef make_signed<int>::type A; typedef make_signed<unsigned>::type B; typedef make_signed<const unsigned>::type C; typedef make_signed<ENUM1>::type D; typedef make_signed<ENUM2>::type E; cout << boolalpha; // Check if the above declared variables // are signed type or not cout << "A is signed type? " << is_same<int, A>::value << endl; cout << "B is signed type? " << is_same<int, B>::value << endl; cout << "C is signed type? " << is_same<int, C>::value << endl; cout << "D is signed type? " << is_same<int, D>::value << endl; cout << "E is signed type? " << is_same<int, E>::value << endl; return 0; } Output: A is signed type? true B is signed type? true C is signed type? false D is signed type? true E is signed type? false Reference: http://www.cplusplus.com/reference/type_traits/make_signed/ Comment More infoAdvertise with us Next Article std::make_signed in C++ with Examples B bansal_rtk_ Follow Improve Article Tags : Misc C++ CPP-Functions Practice Tags : CPPMisc Similar Reads std::is_member_pointer in C++ with Examples The std::is_member_pointer template of C++ STL is present in the <type_traits> header file. The std::is_member_pointer template of C++ STL is used to check whether the T is a pointer to non-static member or not. It return the boolean value true if T is a pointer to non-static member type, Othe 2 min read std::add_lvalue_reference in C++ with Examples The std::add_lvalue_reference template of C++ STL is present in the <type_traits> header file. The std::add_lvalue_reference template of C++ STL is used to get lvalue reference type that refers to T type. An lvalue reference is formed by placing an '&' after some type. An rvalue reference 2 min read std::is_literal_type in C++ with Examples The std::is_literal_type template of C++ STL is present in the <type_traits> header file. The std::is_literal_type template of C++ STL is used to check whether the T is literal type or not. It return the boolean value true if T is literal type, otherwise return false. Header File: #include< 2 min read std::is_same template in C++ with Examples The std::is_same template of C++ STL is present in the <type_traits> header file. The std::is_same template of C++ STL is used to check whether the type A is same type as of B or not. It return the boolean value true if both are same, otherwise return false. Header File: #include<type_trait 3 min read std::add_cv in C++ with Examples The std::add_cv template of C++ STL is present in the <type_traits> header file. The std::add_cv template of C++ STL is used to get the type T with const and volatile qualification. The function std::is_same::value is used to check whether T is a const and volatile qualification or not. Header 2 min read Like