Commit d7ecc1fa authored by Davis King's avatar Davis King

Made the member_function_pointer more robust to the amount of memory in its stack

based block of memory not being big enough.  We should now be guaranteed that it
will either fit or it won't compile.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402630
parent 5faacf97
...@@ -25,9 +25,9 @@ namespace dlib ...@@ -25,9 +25,9 @@ namespace dlib
//----------- kernels --------------- //----------- kernels ---------------
// kernel_1a // kernel_1a
typedef member_function_pointer_kernel_1<PARAM1,PARAM2,PARAM3,PARAM4> typedef mfpk1<PARAM1,PARAM2,PARAM3,PARAM4>
kernel_1a; kernel_1a;
typedef member_function_pointer_kernel_c<kernel_1a> typedef mfpkc<kernel_1a>
kernel_1a_c; kernel_1a_c;
......
...@@ -248,7 +248,7 @@ namespace dlib ...@@ -248,7 +248,7 @@ namespace dlib
void (T::*cb)(PARAM1)const void (T::*cb)(PARAM1)const
); );
operator bool ( operator some_undefined_pointer_type (
) const; ) const;
bool operator! ( bool operator! (
...@@ -315,7 +315,7 @@ namespace dlib ...@@ -315,7 +315,7 @@ namespace dlib
void (T::*cb)(PARAM1,PARAM2)const void (T::*cb)(PARAM1,PARAM2)const
); );
operator bool ( operator some_undefined_pointer_type (
) const; ) const;
bool operator! ( bool operator! (
...@@ -384,7 +384,7 @@ namespace dlib ...@@ -384,7 +384,7 @@ namespace dlib
void (T::*cb)(PARAM1,PARAM2,PARAM3)const void (T::*cb)(PARAM1,PARAM2,PARAM3)const
); );
operator bool ( operator some_undefined_pointer_type (
) const; ) const;
bool operator! ( bool operator! (
...@@ -455,7 +455,7 @@ namespace dlib ...@@ -455,7 +455,7 @@ namespace dlib
void (T::*cb)(PARAM1,PARAM2,PARAM3,PARAM4)const void (T::*cb)(PARAM1,PARAM2,PARAM3,PARAM4)const
); );
operator bool ( operator some_undefined_pointer_type (
) const; ) const;
bool operator! ( bool operator! (
......
...@@ -17,14 +17,14 @@ namespace dlib ...@@ -17,14 +17,14 @@ namespace dlib
typename PARAM3 = typename mfpb::param3_type, typename PARAM3 = typename mfpb::param3_type,
typename PARAM4 = typename mfpb::param4_type typename PARAM4 = typename mfpb::param4_type
> >
class member_function_pointer_kernel_c; class mfpkc;
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
typename mfpb typename mfpb
> >
class member_function_pointer_kernel_c<mfpb,void,void,void,void> : class mfpkc<mfpb,void,void,void,void> :
public mfpb public mfpb
{ {
public: public:
...@@ -88,7 +88,7 @@ namespace dlib ...@@ -88,7 +88,7 @@ namespace dlib
typename mfpb, typename mfpb,
typename PARAM1 typename PARAM1
> >
class member_function_pointer_kernel_c<mfpb,PARAM1,void,void,void> : class mfpkc<mfpb,PARAM1,void,void,void> :
public mfpb public mfpb
{ {
public: public:
...@@ -154,7 +154,7 @@ namespace dlib ...@@ -154,7 +154,7 @@ namespace dlib
typename PARAM1, typename PARAM1,
typename PARAM2 typename PARAM2
> >
class member_function_pointer_kernel_c<mfpb,PARAM1,PARAM2,void,void> : class mfpkc<mfpb,PARAM1,PARAM2,void,void> :
public mfpb public mfpb
{ {
public: public:
...@@ -222,7 +222,7 @@ namespace dlib ...@@ -222,7 +222,7 @@ namespace dlib
typename PARAM2, typename PARAM2,
typename PARAM3 typename PARAM3
> >
class member_function_pointer_kernel_c<mfpb,PARAM1,PARAM2,PARAM3,void> : class mfpkc<mfpb,PARAM1,PARAM2,PARAM3,void> :
public mfpb public mfpb
{ {
public: public:
...@@ -292,7 +292,7 @@ namespace dlib ...@@ -292,7 +292,7 @@ namespace dlib
typename PARAM3, typename PARAM3,
typename PARAM4 typename PARAM4
> >
class member_function_pointer_kernel_c : class mfpkc :
public mfpb public mfpb
{ {
public: public:
......
...@@ -122,11 +122,11 @@ namespace ...@@ -122,11 +122,11 @@ namespace
mfp<int,int,int> a3, b3; mfp<int,int,int> a3, b3;
mfp<int,int,int,int> a4, b4; mfp<int,int,int,int> a4, b4;
member_function_pointer_kernel_c<mfp<> > a0c, b0c; mfpkc<mfp<> > a0c, b0c;
member_function_pointer_kernel_c<mfp<int> > a1c, b1c; mfpkc<mfp<int> > a1c, b1c;
member_function_pointer_kernel_c<mfp<int,int> > a2c, b2c; mfpkc<mfp<int,int> > a2c, b2c;
member_function_pointer_kernel_c<mfp<int,int,int> > a3c, b3c; mfpkc<mfp<int,int,int> > a3c, b3c;
member_function_pointer_kernel_c<mfp<int,int,int,int> > a4c, b4c; mfpkc<mfp<int,int,int,int> > a4c, b4c;
DLIB_CASSERT(a0c == b0c, ""); DLIB_CASSERT(a0c == b0c, "");
DLIB_CASSERT(a1c == b1c, ""); DLIB_CASSERT(a1c == b1c, "");
...@@ -543,8 +543,8 @@ namespace ...@@ -543,8 +543,8 @@ namespace
void perform_test ( void perform_test (
) )
{ {
member_function_pointer_kernel_test<member_function_pointer_kernel_1,mfp_test_helper>(); member_function_pointer_kernel_test<mfpk1,mfp_test_helper>();
member_function_pointer_kernel_test<member_function_pointer_kernel_1,mfp_test_helper_const>(); member_function_pointer_kernel_test<mfpk1,mfp_test_helper_const>();
} }
} a; } a;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment