dcsimg
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Advanced
Jul 3, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 <cstring> // for strlen
#include <functional> // for pointer_to_unary_function
using namespace std;
int main()
{
 char name[]=
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date