Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 1 | #ifndef NDNBOOST_BIND_MEM_FN_HPP_INCLUDED |
| 2 | #define NDNBOOST_BIND_MEM_FN_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 3 | |
| 4 | // MS compatible compilers support #pragma once |
| 5 | |
| 6 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
| 7 | # pragma once |
| 8 | #endif |
| 9 | |
| 10 | // |
| 11 | // mem_fn.hpp - a generalization of std::mem_fun[_ref] |
| 12 | // |
| 13 | // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. |
| 14 | // Copyright (c) 2001 David Abrahams |
| 15 | // Copyright (c) 2003-2005 Peter Dimov |
| 16 | // |
| 17 | // Distributed under the Boost Software License, Version 1.0. (See |
| 18 | // accompanying file LICENSE_1_0.txt or copy at |
| 19 | // http://www.boost.org/LICENSE_1_0.txt) |
| 20 | // |
| 21 | // See http://www.boost.org/libs/bind/mem_fn.html for documentation. |
| 22 | // |
| 23 | |
| 24 | #include <ndnboost/config.hpp> |
| 25 | #include <ndnboost/get_pointer.hpp> |
| 26 | #include <ndnboost/detail/workaround.hpp> |
| 27 | |
| 28 | namespace ndnboost |
| 29 | { |
| 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | #if defined(NDNBOOST_NO_VOID_RETURNS) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 32 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 33 | #define NDNBOOST_MEM_FN_CLASS_F , class F |
| 34 | #define NDNBOOST_MEM_FN_TYPEDEF(X) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 35 | |
| 36 | namespace _mfi // mem_fun_impl |
| 37 | { |
| 38 | |
| 39 | template<class V> struct mf |
| 40 | { |
| 41 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 42 | #define NDNBOOST_MEM_FN_RETURN return |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 43 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 44 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X |
| 45 | #define NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 46 | |
| 47 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 48 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 49 | #undef NDNBOOST_MEM_FN_CC |
| 50 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 51 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 52 | #ifdef NDNBOOST_MEM_FN_ENABLE_CDECL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 53 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 54 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_cdecl |
| 55 | #define NDNBOOST_MEM_FN_CC __cdecl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 56 | |
| 57 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 58 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 59 | #undef NDNBOOST_MEM_FN_CC |
| 60 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 61 | |
| 62 | #endif |
| 63 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 64 | #ifdef NDNBOOST_MEM_FN_ENABLE_STDCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 65 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 66 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_stdcall |
| 67 | #define NDNBOOST_MEM_FN_CC __stdcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 68 | |
| 69 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 70 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 71 | #undef NDNBOOST_MEM_FN_CC |
| 72 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 73 | |
| 74 | #endif |
| 75 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 76 | #ifdef NDNBOOST_MEM_FN_ENABLE_FASTCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 77 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 78 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_fastcall |
| 79 | #define NDNBOOST_MEM_FN_CC __fastcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 80 | |
| 81 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 82 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 83 | #undef NDNBOOST_MEM_FN_CC |
| 84 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 85 | |
| 86 | #endif |
| 87 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 88 | #undef NDNBOOST_MEM_FN_RETURN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 89 | |
| 90 | }; // struct mf<V> |
| 91 | |
| 92 | template<> struct mf<void> |
| 93 | { |
| 94 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 95 | #define NDNBOOST_MEM_FN_RETURN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 96 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 97 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X |
| 98 | #define NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 99 | |
| 100 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 101 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 102 | #undef NDNBOOST_MEM_FN_CC |
| 103 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 104 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 105 | #ifdef NDNBOOST_MEM_FN_ENABLE_CDECL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 106 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 107 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_cdecl |
| 108 | #define NDNBOOST_MEM_FN_CC __cdecl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 109 | |
| 110 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 111 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 112 | #undef NDNBOOST_MEM_FN_CC |
| 113 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 114 | |
| 115 | #endif |
| 116 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 117 | #ifdef NDNBOOST_MEM_FN_ENABLE_STDCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 118 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 119 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_stdcall |
| 120 | #define NDNBOOST_MEM_FN_CC __stdcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 121 | |
| 122 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 123 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 124 | #undef NDNBOOST_MEM_FN_CC |
| 125 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 126 | |
| 127 | #endif |
| 128 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 129 | #ifdef NDNBOOST_MEM_FN_ENABLE_FASTCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 130 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 131 | #define NDNBOOST_MEM_FN_NAME(X) inner_##X##_fastcall |
| 132 | #define NDNBOOST_MEM_FN_CC __fastcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 133 | |
| 134 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 135 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 136 | #undef NDNBOOST_MEM_FN_CC |
| 137 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 138 | |
| 139 | #endif |
| 140 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 141 | #undef NDNBOOST_MEM_FN_RETURN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 142 | |
| 143 | }; // struct mf<void> |
| 144 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 145 | #undef NDNBOOST_MEM_FN_CLASS_F |
| 146 | #undef NDNBOOST_MEM_FN_TYPEDEF_F |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 147 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 148 | #define NDNBOOST_MEM_FN_NAME(X) X |
| 149 | #define NDNBOOST_MEM_FN_NAME2(X) inner_##X |
| 150 | #define NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 151 | |
| 152 | #include <ndnboost/bind/mem_fn_vw.hpp> |
| 153 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 154 | #undef NDNBOOST_MEM_FN_NAME |
| 155 | #undef NDNBOOST_MEM_FN_NAME2 |
| 156 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 157 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 158 | #ifdef NDNBOOST_MEM_FN_ENABLE_CDECL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 159 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 160 | #define NDNBOOST_MEM_FN_NAME(X) X##_cdecl |
| 161 | #define NDNBOOST_MEM_FN_NAME2(X) inner_##X##_cdecl |
| 162 | #define NDNBOOST_MEM_FN_CC __cdecl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 163 | |
| 164 | #include <ndnboost/bind/mem_fn_vw.hpp> |
| 165 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 166 | #undef NDNBOOST_MEM_FN_NAME |
| 167 | #undef NDNBOOST_MEM_FN_NAME2 |
| 168 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 169 | |
| 170 | #endif |
| 171 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 172 | #ifdef NDNBOOST_MEM_FN_ENABLE_STDCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 173 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 174 | #define NDNBOOST_MEM_FN_NAME(X) X##_stdcall |
| 175 | #define NDNBOOST_MEM_FN_NAME2(X) inner_##X##_stdcall |
| 176 | #define NDNBOOST_MEM_FN_CC __stdcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 177 | |
| 178 | #include <ndnboost/bind/mem_fn_vw.hpp> |
| 179 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 180 | #undef NDNBOOST_MEM_FN_NAME |
| 181 | #undef NDNBOOST_MEM_FN_NAME2 |
| 182 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 183 | |
| 184 | #endif |
| 185 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 186 | #ifdef NDNBOOST_MEM_FN_ENABLE_FASTCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 187 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 188 | #define NDNBOOST_MEM_FN_NAME(X) X##_fastcall |
| 189 | #define NDNBOOST_MEM_FN_NAME2(X) inner_##X##_fastcall |
| 190 | #define NDNBOOST_MEM_FN_CC __fastcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 191 | |
| 192 | #include <ndnboost/bind/mem_fn_vw.hpp> |
| 193 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 194 | #undef NDNBOOST_MEM_FN_NAME |
| 195 | #undef NDNBOOST_MEM_FN_NAME2 |
| 196 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 197 | |
| 198 | #endif |
| 199 | |
| 200 | } // namespace _mfi |
| 201 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 202 | #else // #ifdef NDNBOOST_NO_VOID_RETURNS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 203 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 204 | #define NDNBOOST_MEM_FN_CLASS_F |
| 205 | #define NDNBOOST_MEM_FN_TYPEDEF(X) typedef X; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 206 | |
| 207 | namespace _mfi |
| 208 | { |
| 209 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 210 | #define NDNBOOST_MEM_FN_RETURN return |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 211 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 212 | #define NDNBOOST_MEM_FN_NAME(X) X |
| 213 | #define NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 214 | |
| 215 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 216 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 217 | #undef NDNBOOST_MEM_FN_CC |
| 218 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 219 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 220 | #ifdef NDNBOOST_MEM_FN_ENABLE_CDECL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 221 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 222 | #define NDNBOOST_MEM_FN_NAME(X) X##_cdecl |
| 223 | #define NDNBOOST_MEM_FN_CC __cdecl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 224 | |
| 225 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 226 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 227 | #undef NDNBOOST_MEM_FN_CC |
| 228 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 229 | |
| 230 | #endif |
| 231 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 232 | #ifdef NDNBOOST_MEM_FN_ENABLE_STDCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 233 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 234 | #define NDNBOOST_MEM_FN_NAME(X) X##_stdcall |
| 235 | #define NDNBOOST_MEM_FN_CC __stdcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 236 | |
| 237 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 238 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 239 | #undef NDNBOOST_MEM_FN_CC |
| 240 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 241 | |
| 242 | #endif |
| 243 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 244 | #ifdef NDNBOOST_MEM_FN_ENABLE_FASTCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 245 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 246 | #define NDNBOOST_MEM_FN_NAME(X) X##_fastcall |
| 247 | #define NDNBOOST_MEM_FN_CC __fastcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 248 | |
| 249 | #include <ndnboost/bind/mem_fn_template.hpp> |
| 250 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 251 | #undef NDNBOOST_MEM_FN_CC |
| 252 | #undef NDNBOOST_MEM_FN_NAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 253 | |
| 254 | #endif |
| 255 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 256 | #undef NDNBOOST_MEM_FN_RETURN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 257 | |
| 258 | } // namespace _mfi |
| 259 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 260 | #undef NDNBOOST_MEM_FN_CLASS_F |
| 261 | #undef NDNBOOST_MEM_FN_TYPEDEF |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 262 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 263 | #endif // #ifdef NDNBOOST_NO_VOID_RETURNS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 264 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 265 | #define NDNBOOST_MEM_FN_NAME(X) X |
| 266 | #define NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 267 | |
| 268 | #include <ndnboost/bind/mem_fn_cc.hpp> |
| 269 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 270 | #undef NDNBOOST_MEM_FN_NAME |
| 271 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 272 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 273 | #ifdef NDNBOOST_MEM_FN_ENABLE_CDECL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 274 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 275 | #define NDNBOOST_MEM_FN_NAME(X) X##_cdecl |
| 276 | #define NDNBOOST_MEM_FN_CC __cdecl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 277 | |
| 278 | #include <ndnboost/bind/mem_fn_cc.hpp> |
| 279 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 280 | #undef NDNBOOST_MEM_FN_NAME |
| 281 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 282 | |
| 283 | #endif |
| 284 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 285 | #ifdef NDNBOOST_MEM_FN_ENABLE_STDCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 286 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 287 | #define NDNBOOST_MEM_FN_NAME(X) X##_stdcall |
| 288 | #define NDNBOOST_MEM_FN_CC __stdcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 289 | |
| 290 | #include <ndnboost/bind/mem_fn_cc.hpp> |
| 291 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 292 | #undef NDNBOOST_MEM_FN_NAME |
| 293 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 294 | |
| 295 | #endif |
| 296 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 297 | #ifdef NDNBOOST_MEM_FN_ENABLE_FASTCALL |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 298 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 299 | #define NDNBOOST_MEM_FN_NAME(X) X##_fastcall |
| 300 | #define NDNBOOST_MEM_FN_CC __fastcall |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 301 | |
| 302 | #include <ndnboost/bind/mem_fn_cc.hpp> |
| 303 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 304 | #undef NDNBOOST_MEM_FN_NAME |
| 305 | #undef NDNBOOST_MEM_FN_CC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 306 | |
| 307 | #endif |
| 308 | |
| 309 | // data member support |
| 310 | |
| 311 | namespace _mfi |
| 312 | { |
| 313 | |
| 314 | template<class R, class T> class dm |
| 315 | { |
| 316 | public: |
| 317 | |
| 318 | typedef R const & result_type; |
| 319 | typedef T const * argument_type; |
| 320 | |
| 321 | private: |
| 322 | |
| 323 | typedef R (T::*F); |
| 324 | F f_; |
| 325 | |
| 326 | template<class U> R const & call(U & u, T const *) const |
| 327 | { |
| 328 | return (u.*f_); |
| 329 | } |
| 330 | |
| 331 | template<class U> R const & call(U & u, void const *) const |
| 332 | { |
| 333 | return (get_pointer(u)->*f_); |
| 334 | } |
| 335 | |
| 336 | public: |
| 337 | |
| 338 | explicit dm(F f): f_(f) {} |
| 339 | |
| 340 | R & operator()(T * p) const |
| 341 | { |
| 342 | return (p->*f_); |
| 343 | } |
| 344 | |
| 345 | R const & operator()(T const * p) const |
| 346 | { |
| 347 | return (p->*f_); |
| 348 | } |
| 349 | |
| 350 | template<class U> R const & operator()(U const & u) const |
| 351 | { |
| 352 | return call(u, &u); |
| 353 | } |
| 354 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 355 | #if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, <= 1300) && !NDNBOOST_WORKAROUND(__MWERKS__, < 0x3200) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 356 | |
| 357 | R & operator()(T & t) const |
| 358 | { |
| 359 | return (t.*f_); |
| 360 | } |
| 361 | |
| 362 | R const & operator()(T const & t) const |
| 363 | { |
| 364 | return (t.*f_); |
| 365 | } |
| 366 | |
| 367 | #endif |
| 368 | |
| 369 | bool operator==(dm const & rhs) const |
| 370 | { |
| 371 | return f_ == rhs.f_; |
| 372 | } |
| 373 | |
| 374 | bool operator!=(dm const & rhs) const |
| 375 | { |
| 376 | return f_ != rhs.f_; |
| 377 | } |
| 378 | }; |
| 379 | |
| 380 | } // namespace _mfi |
| 381 | |
| 382 | template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f) |
| 383 | { |
| 384 | return _mfi::dm<R, T>(f); |
| 385 | } |
| 386 | |
| 387 | } // namespace ndnboost |
| 388 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 389 | #endif // #ifndef NDNBOOST_BIND_MEM_FN_HPP_INCLUDED |