std::is_member_function_pointer template in C++ with Examples Last Updated : 27 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The std::is_member_function_pointer template of C++ STL is present in the <type_traits> header file. The std::is_member_function_pointer template of C++ STL is used to check whether the T is a pointer to non-static member function or not. It return the boolean value true if T is pointer to non-static member function, otherwise return false. Header File: #include<type_traits> Template Class: template <class T> struct is_member_function_pointer; Syntax: std::is_member_function_pointer::value Parameter: The template std::is_member_function_pointer accepts a single parameter T(Trait class) to check whether T is pointer to non-static member function or not. Return Value: This template std::is_member_object_pointer returns a boolean variable as shown below: True: If the type T is a pointer to non-static member function type. False: If the type T is not a pointer to non-static member function type. Below is the program to demonstrate std::is_member_function_pointer in C++: Program 1: CPP14 // C++ program to illustrate // std::is_member_function_pointer #include <bits/stdc++.h> #include <type_traits> using namespace std; // Declare a structure class GFG { public: int gfg; }; class A { }; // Driver Code int main() { // Object to class GFG int GFG::*pt = &GFG::gfg; cout << boolalpha; // Check if GFG* is a member function // pointer or not cout << "GFG*: " << is_member_function_pointer<GFG*>::value << endl; // Check if int GFG::* is a member // function pointer or not cout << "int GFG::* " << is_member_function_pointer<int GFG::*>::value << endl; // Check if int A::* is a member // function pointer or not cout << "int A::* " << is_member_function_pointer<int A::*>::value << endl; // Check if int A::*() is a member // function pointer or not cout << "int A::*() " << is_member_function_pointer<int (A::*)()>::value << endl; return 0; } Output: GFG*: false int GFG::* false int A::* false int A::*() true Program 2: CPP14 // C++ program to illustrate // std::is_member_function_pointer #include <bits/stdc++.h> #include <type_traits> using namespace std; // Declare a structure struct A { void fn(){}; }; struct B { int x; }; // Driver Code int main() { void (A::*pt)() = &A::fn; cout << boolalpha; cout << "A*: " << is_member_function_pointer<A*>::value << endl; cout << "void(A::*)(): " << is_member_function_pointer<void (A::*)()>::value << endl; cout << "B*: " << is_member_function_pointer<B*>::value << endl; cout << "void(B::*)(): " << is_member_function_pointer<void (B::*)()>::value << endl; return 0; } Output: A*: false void(A::*)(): true B*: false void(B::*)(): true Reference: http://www.cplusplus.com/reference/type_traits/is_member_function_pointer/ Comment More infoAdvertise with us B bansal_rtk_ Follow Improve Article Tags : Misc C++ CPP-Functions CPP-type_traits Practice Tags : CPPMisc Similar Reads C++ Programming Language C++ is a computer programming language developed by Bjarne Stroustrup as an extension of the C language. It is known for is fast speed, low level memory management and is often taught as first programming language. It provides:Hands-on application of different programming concepts.Similar syntax to 5 min read SQL Commands | DDL, DQL, DML, DCL and TCL Commands SQL commands are crucial for managing databases effectively. These commands are divided into categories such as Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Data Query Language (DQL), and Transaction Control Language (TCL). In this article, we will e 7 min read TCP/IP Model The TCP/IP model is a framework that is used to model the communication in a network. It is mainly a collection of network protocols and organization of these protocols in different layers for modeling the network.It has four layers, Application, Transport, Network/Internet and Network Access.While 7 min read Basics of Computer Networking A computer network is a collection of interconnected devices that share resources and information. These devices can include computers, servers, printers, and other hardware. Networks allow for the efficient exchange of data, enabling various applications such as email, file sharing, and internet br 14 min read Object Oriented Programming in C++ Object Oriented Programming - As the name suggests uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc. in programming. The main aim of OOP is to bind together the data and the functions that operate on them so th 5 min read Java Programs - Java Programming Examples In this article, we will learn and prepare for Interviews using Java Programming Examples. From basic Java programs like the Fibonacci series, Prime numbers, Factorial numbers, and Palindrome numbers to advanced Java programs.Java is one of the most popular programming languages today because of its 8 min read Unified Modeling Language (UML) Diagrams Unified Modeling Language (UML) is a general-purpose modeling language. The main aim of UML is to define a standard way to visualize the way a system has been designed. It is quite similar to blueprints used in other fields of engineering. UML is not a programming language, it is rather a visual lan 14 min read Second Largest Element in an Array Given an array of positive integers arr[] of size n, the task is to find second largest distinct element in the array.Note: If the second largest element does not exist, return -1. Examples:Input: arr[] = [12, 35, 1, 10, 34, 1]Output: 34Explanation: The largest element of the array is 35 and the sec 14 min read Python Lists In Python, a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list. A list may contain mixed type of items, this is possible because a list mainly stores references at contiguous locations and actual items maybe s 6 min read Introduction to Java Java is a high-level, object-oriented programming language developed by Sun Microsystems in 1995. It is platform-independent, which means we can write code once and run it anywhere using the Java Virtual Machine (JVM). Java is mostly used for building desktop applications, web applications, Android 4 min read Like