00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00048 #ifndef STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS
00049 #define STLSOFT_INCL_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS_MAJOR 4
00053 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS_MINOR 2
00054 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS_REVISION 2
00055 # define STLSOFT_VER_STLSOFT_FUNCTIONAL_HPP_FUNCTION_POINTER_ADAPTORS_EDIT 62
00056 #endif
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00067 # include <stlsoft/stlsoft.h>
00068 #endif
00069
00070 #ifndef STLSOFT_INCL_FUNCTIONAL
00071 # define STLSOFT_INCL_FUNCTIONAL
00072 # include <functional>
00073 #endif
00074
00075
00076
00077
00078
00079 #ifndef _STLSOFT_NO_NAMESPACE
00080 namespace stlsoft
00081 {
00082 #endif
00083
00084
00085
00086
00087
00088 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00089
00094
00095 template< ss_typename_param_k R
00096 , ss_typename_param_k A
00097 >
00098 struct unary_cdecl_function_pointer
00099 : public stlsoft_ns_qual_std(unary_function)<A, R>
00100 {
00101 public:
00102 typedef R return_type;
00103 typedef A argument_type;
00104 typedef return_type (STLSOFT_CDECL *function_type)(argument_type);
00105 public:
00106 ss_explicit_k unary_cdecl_function_pointer(function_type func)
00107 : m_func(func)
00108 {}
00109 return_type operator ()(argument_type arg) const
00110 {
00111 return (*m_func)(arg);
00112 }
00113 private:
00114 function_type m_func;
00115 };
00116
00122
00123 template< ss_typename_param_k R
00124 , ss_typename_param_k A0
00125 , ss_typename_param_k A1
00126 >
00127 struct binary_cdecl_function_pointer
00128 : public stlsoft_ns_qual_std(binary_function)<A0, A1, R>
00129 {
00130 public:
00131 typedef R return_type;
00132 typedef A0 first_argument_type;
00133 typedef A1 second_argument_type;
00134 typedef return_type (STLSOFT_CDECL *function_type)(first_argument_type, second_argument_type);
00135 public:
00136 ss_explicit_k binary_cdecl_function_pointer(function_type func)
00137 : m_func(func)
00138 {}
00139 return_type operator ()(first_argument_type a0, second_argument_type a1) const
00140 {
00141 return (*m_func)(a0, a1);
00142 }
00143 private:
00144 function_type m_func;
00145 };
00146 # endif
00147
00148 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00149
00154
00155 template< ss_typename_param_k R
00156 , ss_typename_param_k A
00157 >
00158 struct unary_fastcall_function_pointer
00159 : public stlsoft_ns_qual_std(unary_function)<A, R>
00160 {
00161 public:
00162 typedef R return_type;
00163 typedef A argument_type;
00164 typedef return_type (STLSOFT_FASTCALL *function_type)(argument_type);
00165 public:
00166 ss_explicit_k unary_fastcall_function_pointer(function_type func)
00167 : m_func(func)
00168 {}
00169 return_type operator ()(argument_type arg) const
00170 {
00171 return (*m_func)(arg);
00172 }
00173 private:
00174 function_type m_func;
00175 };
00176
00182
00183 template< ss_typename_param_k R
00184 , ss_typename_param_k A0
00185 , ss_typename_param_k A1
00186 >
00187 struct binary_fastcall_function_pointer
00188 : public stlsoft_ns_qual_std(binary_function)<A0, A1, R>
00189 {
00190 public:
00191 typedef R return_type;
00192 typedef A0 first_argument_type;
00193 typedef A1 second_argument_type;
00194 typedef return_type (STLSOFT_FASTCALL *function_type)(first_argument_type, second_argument_type);
00195 public:
00196 ss_explicit_k binary_fastcall_function_pointer(function_type func)
00197 : m_func(func)
00198 {}
00199 return_type operator ()(first_argument_type a0, second_argument_type a1) const
00200 {
00201 return (*m_func)(a0, a1);
00202 }
00203 private:
00204 function_type m_func;
00205 };
00206 # endif
00207
00208 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00209
00214
00215 template< ss_typename_param_k R
00216 , ss_typename_param_k A
00217 >
00218 struct unary_stdcall_function_pointer
00219 : public stlsoft_ns_qual_std(unary_function)<A, R>
00220 {
00221 public:
00222 typedef R return_type;
00223 typedef A argument_type;
00224 typedef return_type (STLSOFT_STDCALL *function_type)(argument_type);
00225 public:
00226 ss_explicit_k unary_stdcall_function_pointer(function_type func)
00227 : m_func(func)
00228 {}
00229 return_type operator ()(argument_type arg) const
00230 {
00231 return (*m_func)(arg);
00232 }
00233 private:
00234 function_type m_func;
00235 };
00236
00242
00243 template< ss_typename_param_k R
00244 , ss_typename_param_k A0
00245 , ss_typename_param_k A1
00246 >
00247 struct binary_stdcall_function_pointer
00248 : public stlsoft_ns_qual_std(binary_function)<A0, A1, R>
00249 {
00250 public:
00251 typedef R return_type;
00252 typedef A0 first_argument_type;
00253 typedef A1 second_argument_type;
00254 typedef return_type (STLSOFT_STDCALL *function_type)(first_argument_type, second_argument_type);
00255 public:
00256 ss_explicit_k binary_stdcall_function_pointer(function_type func)
00257 : m_func(func)
00258 {}
00259 return_type operator ()(first_argument_type a0, second_argument_type a1) const
00260 {
00261 return (*m_func)(a0, a1);
00262 }
00263 private:
00264 function_type m_func;
00265 };
00266 # endif
00267
00268
00269 #if !defined(STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID)
00270 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00271
00277
00278 template <ss_typename_param_k A>
00279 struct unary_cdecl_void_function_pointer
00280 : public stlsoft_ns_qual_std(unary_function)<A, void>
00281 {
00282 public:
00283 typedef void return_type;
00284 typedef A argument_type;
00285 typedef return_type (STLSOFT_CDECL *function_type)(argument_type);
00286 public:
00287 ss_explicit_k unary_cdecl_void_function_pointer(function_type func)
00288 : m_func(func)
00289 {}
00290 void operator ()(argument_type arg) const
00291 {
00292 (*m_func)(arg);
00293 }
00294 private:
00295 function_type m_func;
00296 };
00297
00304
00305 template< ss_typename_param_k A0
00306 , ss_typename_param_k A1
00307 >
00308 struct binary_cdecl_void_function_pointer
00309 : public stlsoft_ns_qual_std(binary_function)<A0, A1, void>
00310 {
00311 public:
00312 typedef void return_type;
00313 typedef A0 first_argument_type;
00314 typedef A1 second_argument_type;
00315 typedef return_type (STLSOFT_CDECL *function_type)(first_argument_type, second_argument_type);
00316 public:
00317 ss_explicit_k binary_cdecl_void_function_pointer(function_type func)
00318 : m_func(func)
00319 {}
00320 void operator ()(first_argument_type a0, second_argument_type a1) const
00321 {
00322 (*m_func)(a0, a1);
00323 }
00324 private:
00325 function_type m_func;
00326 };
00327 # endif
00328
00329 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00330
00336
00337 template <ss_typename_param_k A>
00338 struct unary_fastcall_void_function_pointer
00339 : public stlsoft_ns_qual_std(unary_function)<A, void>
00340 {
00341 public:
00342 typedef void return_type;
00343 typedef A argument_type;
00344 typedef return_type (STLSOFT_FASTCALL *function_type)(argument_type);
00345 public:
00346 ss_explicit_k unary_fastcall_void_function_pointer(function_type func)
00347 : m_func(func)
00348 {}
00349 void operator ()(argument_type arg) const
00350 {
00351 (*m_func)(arg);
00352 }
00353 private:
00354 function_type m_func;
00355 };
00356
00363
00364 template< ss_typename_param_k A0
00365 , ss_typename_param_k A1
00366 >
00367 struct binary_fastcall_void_function_pointer
00368 : public stlsoft_ns_qual_std(binary_function)<A0, A1, void>
00369 {
00370 public:
00371 typedef void return_type;
00372 typedef A0 first_argument_type;
00373 typedef A1 second_argument_type;
00374 typedef return_type (STLSOFT_FASTCALL *function_type)(first_argument_type, second_argument_type);
00375 public:
00376 ss_explicit_k binary_fastcall_void_function_pointer(function_type func)
00377 : m_func(func)
00378 {}
00379 void operator ()(first_argument_type a0, second_argument_type a1) const
00380 {
00381 (*m_func)(a0, a1);
00382 }
00383 private:
00384 function_type m_func;
00385 };
00386 # endif
00387
00388 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00389
00395
00396 template <ss_typename_param_k A>
00397 struct unary_stdcall_void_function_pointer
00398 : public stlsoft_ns_qual_std(unary_function)<A, void>
00399 {
00400 public:
00401 typedef void return_type;
00402 typedef A argument_type;
00403 typedef return_type (STLSOFT_STDCALL *function_type)(argument_type);
00404 public:
00405 ss_explicit_k unary_stdcall_void_function_pointer(function_type func)
00406 : m_func(func)
00407 {}
00408 void operator ()(argument_type arg) const
00409 {
00410 (*m_func)(arg);
00411 }
00412 private:
00413 function_type m_func;
00414 };
00415
00422
00423 template< ss_typename_param_k A0
00424 , ss_typename_param_k A1
00425 >
00426 struct binary_stdcall_void_function_pointer
00427 : public stlsoft_ns_qual_std(binary_function)<A0, A1, void>
00428 {
00429 public:
00430 typedef void return_type;
00431 typedef A0 first_argument_type;
00432 typedef A1 second_argument_type;
00433 typedef return_type (STLSOFT_STDCALL *function_type)(first_argument_type, second_argument_type);
00434 public:
00435 ss_explicit_k binary_stdcall_void_function_pointer(function_type func)
00436 : m_func(func)
00437 {}
00438 void operator ()(first_argument_type a0, second_argument_type a1) const
00439 {
00440 (*m_func)(a0, a1);
00441 }
00442 private:
00443 function_type m_func;
00444 };
00445 # endif
00446 #endif
00447
00448
00449
00450
00451
00452 #ifdef STLSOFT_CF_CDECL_SUPPORTED
00453
00458 template< ss_typename_param_k R
00459 , ss_typename_param_k A
00460 >
00461 unary_cdecl_function_pointer<R, A> ptr_fun(R (STLSOFT_CDECL *func)(A))
00462 {
00463 return unary_cdecl_function_pointer<R, A>(func);
00464 }
00465
00471 template< ss_typename_param_k R
00472 , ss_typename_param_k A0
00473 , ss_typename_param_k A1
00474 >
00475 binary_cdecl_function_pointer<R, A0, A1> ptr_fun(R (STLSOFT_CDECL *func)(A0, A1))
00476 {
00477 return binary_cdecl_function_pointer<R, A0, A1>(func);
00478 }
00479 #endif
00480
00481 #ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00482
00487 template< ss_typename_param_k R
00488 , ss_typename_param_k A
00489 >
00490 unary_fastcall_function_pointer<R, A> ptr_fun(R (STLSOFT_FASTCALL *func)(A))
00491 {
00492 return unary_fastcall_function_pointer<R, A>(func);
00493 }
00494
00500 template< ss_typename_param_k R
00501 , ss_typename_param_k A0
00502 , ss_typename_param_k A1
00503 >
00504 binary_fastcall_function_pointer<R, A0, A1> ptr_fun(R (STLSOFT_FASTCALL *func)(A0, A1))
00505 {
00506 return binary_fastcall_function_pointer<R, A0, A1>(func);
00507 }
00508 #endif
00509
00510 #ifdef STLSOFT_CF_STDCALL_SUPPORTED
00511
00516 template< ss_typename_param_k R
00517 , ss_typename_param_k A
00518 >
00519 unary_stdcall_function_pointer<R, A> ptr_fun(R (STLSOFT_STDCALL *func)(A))
00520 {
00521 return unary_stdcall_function_pointer<R, A>(func);
00522 }
00523
00529 template< ss_typename_param_k R
00530 , ss_typename_param_k A0
00531 , ss_typename_param_k A1
00532 >
00533 binary_stdcall_function_pointer<R, A0, A1> ptr_fun(R (STLSOFT_STDCALL *func)(A0, A1))
00534 {
00535 return binary_stdcall_function_pointer<R, A0, A1>(func);
00536 }
00537 #endif
00538
00539
00540 #if defined(STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID)
00541
00542 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00543
00549 template <ss_typename_param_k A>
00550 unary_cdecl_function_pointer<void, A> ptr_fun_void(void (STLSOFT_CDECL *func)(A))
00551 {
00552 return unary_cdecl_function_pointer<void, A>(func);
00553 }
00554
00561 template< ss_typename_param_k A0
00562 , ss_typename_param_k A1
00563 >
00564 binary_cdecl_function_pointer<void, A0, A1> ptr_fun_void(void (STLSOFT_CDECL *func)(A0, A1))
00565 {
00566 return binary_cdecl_function_pointer<void, A0, A1>(func);
00567 }
00568 # endif
00569
00570 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00571
00577 template <ss_typename_param_k A>
00578 unary_fastcall_function_pointer<void, A> ptr_fun_void(void (STLSOFT_FASTCALL *func)(A))
00579 {
00580 return unary_fastcall_function_pointer<void, A>(func);
00581 }
00582
00589 template< ss_typename_param_k A0
00590 , ss_typename_param_k A1
00591 >
00592 binary_fastcall_function_pointer<void, A0, A1> ptr_fun_void(void (STLSOFT_FASTCALL *func)(A0, A1))
00593 {
00594 return binary_fastcall_function_pointer<void, A0, A1>(func);
00595 }
00596 # endif
00597
00598 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00599
00605 template <ss_typename_param_k A>
00606 unary_stdcall_function_pointer<void, A> ptr_fun_void(void (STLSOFT_STDCALL *func)(A))
00607 {
00608 return unary_stdcall_function_pointer<void, A>(func);
00609 }
00610
00617 template< ss_typename_param_k A0
00618 , ss_typename_param_k A1
00619 >
00620 binary_stdcall_function_pointer<void, A0, A1> ptr_fun_void(void (STLSOFT_STDCALL *func)(A0, A1))
00621 {
00622 return binary_stdcall_function_pointer<void, A0, A1>(func);
00623 }
00624 # endif
00625
00626
00627 #else
00628
00629 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00630
00636 template <ss_typename_param_k A>
00637 unary_cdecl_void_function_pointer<A> ptr_fun_void(void (STLSOFT_CDECL *func)(A))
00638 {
00639 return unary_cdecl_void_function_pointer<A>(func);
00640 }
00647 template <ss_typename_param_k A>
00648 unary_cdecl_void_function_pointer<A> ptr_fun(void (STLSOFT_CDECL *func)(A))
00649 {
00650 return ptr_fun_void(func);
00651 }
00652
00659 template< ss_typename_param_k A0
00660 , ss_typename_param_k A1
00661 >
00662 binary_cdecl_void_function_pointer<A0, A1> ptr_fun_void(void (STLSOFT_CDECL *func)(A0, A1))
00663 {
00664 return binary_cdecl_void_function_pointer<A0, A1>(func);
00665 }
00672 template< ss_typename_param_k A0
00673 , ss_typename_param_k A1
00674 >
00675 binary_cdecl_void_function_pointer<A0, A1> ptr_fun(void (STLSOFT_CDECL *func)(A0, A1))
00676 {
00677 return ptr_fun_void(func);
00678 }
00679 # endif
00680
00681 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00682
00688 template <ss_typename_param_k A>
00689 unary_fastcall_void_function_pointer<A> ptr_fun_void(void (STLSOFT_FASTCALL *func)(A))
00690 {
00691 return unary_fastcall_void_function_pointer<A>(func);
00692 }
00699 template <ss_typename_param_k A>
00700 unary_fastcall_void_function_pointer<A> ptr_fun(void (STLSOFT_FASTCALL *func)(A))
00701 {
00702 return ptr_fun_void(func);
00703 }
00704
00711 template< ss_typename_param_k A0
00712 , ss_typename_param_k A1
00713 >
00714 binary_fastcall_void_function_pointer<A0, A1> ptr_fun_void(void (STLSOFT_FASTCALL *func)(A0, A1))
00715 {
00716 return binary_fastcall_void_function_pointer<A0, A1>(func);
00717 }
00724 template< ss_typename_param_k A0
00725 , ss_typename_param_k A1
00726 >
00727 binary_fastcall_void_function_pointer<A0, A1> ptr_fun(void (STLSOFT_FASTCALL *func)(A0, A1))
00728 {
00729 return ptr_fun_void(func);
00730 }
00731 # endif
00732
00733 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00734
00740 template <ss_typename_param_k A>
00741 unary_stdcall_void_function_pointer<A> ptr_fun_void(void (STLSOFT_STDCALL *func)(A))
00742 {
00743 return unary_stdcall_void_function_pointer<A>(func);
00744 }
00751 template <ss_typename_param_k A>
00752 unary_stdcall_void_function_pointer<A> ptr_fun(void (STLSOFT_STDCALL *func)(A))
00753 {
00754 return ptr_fun_void(func);
00755 }
00756
00763 template< ss_typename_param_k A0
00764 , ss_typename_param_k A1
00765 >
00766 binary_stdcall_void_function_pointer<A0, A1> ptr_fun_void(void (STLSOFT_STDCALL *func)(A0, A1))
00767 {
00768 return binary_stdcall_void_function_pointer<A0, A1>(func);
00769 }
00776 template< ss_typename_param_k A0
00777 , ss_typename_param_k A1
00778 >
00779 binary_stdcall_void_function_pointer<A0, A1> ptr_fun(void (STLSOFT_STDCALL *func)(A0, A1))
00780 {
00781 return ptr_fun_void(func);
00782 }
00783 # endif
00784
00785 #endif
00786
00787
00788
00789 #ifndef _STLSOFT_NO_NAMESPACE
00790 }
00791 #endif
00792
00793
00794
00795 #endif
00796
00797