BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmf_memberpointertraits

Detailed Description

Outline

Purpose

Provide meta-function to detect pointer to member traits.

Classes

See also
bslmf_memberfunctionpointertraits

Description

This component provides a meta-function, bslmf::MemberPointerTraits, that determines traits of a pointer-to-member type, including the type of the object that it is a member of, and the type of the member it addresses.

Usage

Define the following struct with the following members:

struct MyTestClass {
int func1(int) { return 0; }
int d_int;
};

In order to deduce the types of func1 and d_int, we will use bslmf::MemberPointerTraits.

template <class MEMBER, class CLASS, class t_TYPE>
void checkMemberPointer(t_TYPE pointer)
{
(void) pointer;
MemberType;
ClassType;
}
Definition bslmf_issame.h:146
Definition bslmf_memberpointertraits.h:113

The following program should compile and run without errors:

void usageExample()
{
checkMemberPointer<int(int), MyTestClass>(&MyTestClass::func1);
checkMemberPointer<int, MyTestClass>(&MyTestClass::d_int);
}