ReactOS  0.4.15-dev-2522-g9e0a3cd
MemFunPtrTest Class Reference
Inheritance diagram for MemFunPtrTest:
Collaboration diagram for MemFunPtrTest:

Protected Member Functions

void mem_ptr_fun ()
 
void find ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (MemFunPtrTest)
 
 CPPUNIT_TEST (mem_ptr_fun)
 
 CPPUNIT_TEST (find)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 15 of file mfunptr_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

MemFunPtrTest::CPPUNIT_TEST ( mem_ptr_fun  )
private

◆ CPPUNIT_TEST() [2/2]

MemFunPtrTest::CPPUNIT_TEST ( find  )
private

◆ CPPUNIT_TEST_SUITE()

MemFunPtrTest::CPPUNIT_TEST_SUITE ( MemFunPtrTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

MemFunPtrTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ find()

void MemFunPtrTest::find ( )
protected

Definition at line 193 of file mfunptr_test.cpp.

194 {
195 #if !defined (STLPORT) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
196  vector<V> v;
197 
198  v.push_back( V(1) );
199  v.push_back( V(2) );
200  v.push_back( V(3) );
201 
202  // step-by-step complication of work for compiler:
203 
204  // step 1:
207  vector<V>::iterator i = find_if( v.begin(), v.end(), b );
208  CPPUNIT_ASSERT(i != v.end());
209  CPPUNIT_ASSERT(i->v == 2);
210 
211  // step 2, just check that compiler understand what pass to bind2nd:
213 
214  // step 3, the same as step 1, but more intellect from compiler required:
216 
217  vector<V>::iterator j = find_if( v.begin(), v.end(), b3 );
218  CPPUNIT_ASSERT(j != v.end());
219  CPPUNIT_ASSERT(j->v == 2);
220 
221  // step 4, more brief, more complex:
222  vector<V>::iterator k = find_if( v.begin(), v.end(), bind2nd( mem_fun_ref( &V::f ), 2 ) );
223  CPPUNIT_ASSERT(k != v.end());
224  CPPUNIT_ASSERT(k->v == 2);
225 #endif
226 }
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
Definition: _algobase.c:214
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:252
value_type * iterator
Definition: _vector.h:124
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
bool f(int _v) const
#define V(i, a, b, c, d)
Definition: jaricom.c:29
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
mem_fun_ref_t< _Result, _Tp > mem_fun_ref(_Result(_Tp::*__f)())
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:592
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
int k
Definition: mpi.c:3369

◆ mem_ptr_fun()

void MemFunPtrTest::mem_ptr_fun ( )
protected

Definition at line 71 of file mfunptr_test.cpp.

72 {
73  Class obj;
74  const Class& objc = obj;
75 
76  // ptr_fun
77 
78  ptr_fun(f1)(s1);
79  ptr_fun(f2)(s1, s2);
80 
81  ptr_fun(f1c)(s1);
82  ptr_fun(f2c)(s1, s2);
83 
84 #ifndef _STLP_DONT_TEST_RETURN_VOID
85  ptr_fun(vf1)(s1);
86  ptr_fun(vf2)(s1, s2);
87 
88  ptr_fun(vf1c)(s1);
89  ptr_fun(vf2c)(s1, s2);
90 #endif /* _STLP_DONT_TEST_RETURN_VOID */
91 
92  // mem_fun
93 
94  mem_fun(&Class::f0)(&obj);
95  mem_fun(&Class::f1)(&obj, s1);
96 
97 #ifndef _STLP_DONT_TEST_RETURN_VOID
99  mem_fun(&Class::vf1)(&obj, s1);
100 #endif /* _STLP_DONT_TEST_RETURN_VOID */
101 
102  // mem_fun (const)
103 
104  mem_fun(&Class::f0c)(&objc);
105  mem_fun(&Class::f1c)(&objc, s1);
106 
107 #ifndef _STLP_DONT_TEST_RETURN_VOID
108  mem_fun(&Class::vf0c)(&objc);
109  mem_fun(&Class::vf1c)(&objc, s1);
110 #endif /* _STLP_DONT_TEST_RETURN_VOID */
111 
112  // mem_fun_ref
113 
116 
117 #ifndef _STLP_DONT_TEST_RETURN_VOID
120 #endif /* _STLP_DONT_TEST_RETURN_VOID */
121 
122  // mem_fun_ref (const)
123  mem_fun_ref(&Class::f0c)(objc);
124  mem_fun_ref(&Class::f1c)(objc, s1);
125 
126 #ifndef _STLP_DONT_TEST_RETURN_VOID
127  mem_fun_ref(&Class::vf0c)(objc);
128  mem_fun_ref(&Class::vf1c)(objc, s1);
129 #endif /* _STLP_DONT_TEST_RETURN_VOID */
130 }
struct S2 s2
int f1c(const S1 &)
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__f)(_Arg))
void vf1(const S1 &)
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
void vf2c(const S1 &, const S2 &)
mem_fun_t< _Result, _Tp > mem_fun(_Result(_Tp::*__f)())
int f0c() const
void vf0()
void vf1c(const S1 &) const
struct S1 s1
void vf2(S1 &, S2 &)
void vf0c() const
void vf1c(const S1 &)
int f1(S1 &)
mem_fun_ref_t< _Result, _Tp > mem_fun_ref(_Result(_Tp::*__f)())
int f0()
void vf1(S1 &)
int f1(const S1 &)
int f2c(const S1 &, const S2 &)
int f2(S1 &, S2 &)
int f1c(const S1 &) const

The documentation for this class was generated from the following file: