ReactOS  0.4.15-dev-5097-g328cc41
fadapter.h
Go to the documentation of this file.
1 #ifndef _fadapter_h_
2 #define _fadapter_h_
3 
4 #include <functional>
5 
6 // used as adaptor's return/argument type,
7 // to allow binders/composers usage
8 struct __void_tag {};
9 
10 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
11 using std::unary_function;
12 #endif
13 
14 template <class Result>
16 protected:
17  Result (*ptr)();
18 public:
19  explicit pointer_to_void_function(Result (*x)()) : ptr(x) {}
20  Result operator()() const { return ptr(); }
21  Result operator()(__void_tag) const { return ptr(); }
22 };
23 
24 // to feed composers
25 template <class Arg1>
26 struct projectvoid : public unary_function<Arg1,__void_tag> {
27  __void_tag operator()(const Arg1& x) const { return __void_tag(); }
28 };
29 
30 #if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
31 
32 template <class Result>
35 }
36 
37 // alternate name
38 template <class Result>
41 }
42 
43 #endif /* !defined (_STLP_MEMBER_POINTER_PARAM_BUG) */
44 
45 template <class Arg>
46 class pointer_to_unary_procedure /* :public unary_function<Arg, __void_tag> */ {
47 protected:
48  typedef void (*fun_type)(Arg);
50 public:
51  typedef Arg argument_type;
54  void operator() (Arg x) const { ptr(x); }
55 };
56 
57 template <class Arg>
60 }
61 
62 template <class Arg1, class Arg2>
63 class pointer_to_binary_procedure /* : public unary_function<Arg1, Arg2, __void_tag> */ {
64 protected:
65  typedef void (*fun_type)(Arg1, Arg2);
67 public:
68  typedef Arg1 first_argument_type;
69  typedef Arg2 second_argument_type;
72  void operator() (Arg1 x, Arg2 y) const { ptr(x, y); }
73 };
74 
75 template <class Arg1, class Arg2>
76 inline pointer_to_binary_procedure<Arg1, Arg2> ptr_proc(void (*x)(Arg1, Arg2)) {
78 }
79 
80 #endif
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void operator()(Arg x) const
Definition: fadapter.h:54
pointer_to_void_function(Result(*x)())
Definition: fadapter.h:19
void operator()(Arg1 x, Arg2 y) const
Definition: fadapter.h:72
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void(* fun_type)(Arg1, Arg2)
Definition: fadapter.h:65
pointer_to_void_function< Result > ptr_fun(Result(*x)())
Definition: fadapter.h:33
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
pointer_to_unary_procedure(fun_type x)
Definition: fadapter.h:53
__void_tag operator()(const Arg1 &x) const
Definition: fadapter.h:27
pointer_to_unary_procedure< Arg > ptr_proc(void(*x)(Arg))
Definition: fadapter.h:58
void(* fun_type)(Arg)
Definition: fadapter.h:48
Result operator()() const
Definition: fadapter.h:20
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
pointer_to_void_function< Result > ptr_gen(Result(*x)())
Definition: fadapter.h:39
Result operator()(__void_tag) const
Definition: fadapter.h:21
pointer_to_binary_procedure(fun_type x)
Definition: fadapter.h:71