devxlogo

The std::pointer_to_unary_function Template

The std::pointer_to_unary_function Template

The Standard Library defines several template adaptors for function pointers. The std::pointer_to_unary_function class template encapsulates a pointer to a single argument function. std::pointer_to_unary_function overloads the () operators so that you can use an instance of this template as a function. In the following example, this template serves as a wrapper for the function strlen(). The template arguments, namely const char * and size_t, are the bound function’s argument and return type, respectively (strlen() takes a const char * and returns a value of type size_t):

 #include  // for strlen#include  // for pointer_to_unary_functionusing namespace std;int main(){ char name[]=

See also  11 Effective Keyword Research Tools and Techniques
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist