1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/mem_fn.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,389 @@
1.4 +#ifndef BOOST_MEM_FN_HPP_INCLUDED
1.5 +#define BOOST_MEM_FN_HPP_INCLUDED
1.6 +
1.7 +// MS compatible compilers support #pragma once
1.8 +
1.9 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.10 +# pragma once
1.11 +#endif
1.12 +
1.13 +//
1.14 +// mem_fn.hpp - a generalization of std::mem_fun[_ref]
1.15 +//
1.16 +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
1.17 +// Copyright (c) 2001 David Abrahams
1.18 +// Copyright (c) 2003-2005 Peter Dimov
1.19 +//
1.20 +// Distributed under the Boost Software License, Version 1.0. (See
1.21 +// accompanying file LICENSE_1_0.txt or copy at
1.22 +// http://www.boost.org/LICENSE_1_0.txt)
1.23 +//
1.24 +// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
1.25 +//
1.26 +
1.27 +#include <boost/config.hpp>
1.28 +#include <boost/get_pointer.hpp>
1.29 +#include <boost/detail/workaround.hpp>
1.30 +
1.31 +namespace boost
1.32 +{
1.33 +
1.34 +#if defined(BOOST_NO_VOID_RETURNS)
1.35 +
1.36 +#define BOOST_MEM_FN_CLASS_F , class F
1.37 +#define BOOST_MEM_FN_TYPEDEF(X)
1.38 +
1.39 +namespace _mfi // mem_fun_impl
1.40 +{
1.41 +
1.42 +template<class V> struct mf
1.43 +{
1.44 +
1.45 +#define BOOST_MEM_FN_RETURN return
1.46 +
1.47 +#define BOOST_MEM_FN_NAME(X) inner_##X
1.48 +#define BOOST_MEM_FN_CC
1.49 +
1.50 +#include <boost/bind/mem_fn_template.hpp>
1.51 +
1.52 +#undef BOOST_MEM_FN_CC
1.53 +#undef BOOST_MEM_FN_NAME
1.54 +
1.55 +#ifdef BOOST_MEM_FN_ENABLE_CDECL
1.56 +
1.57 +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
1.58 +#define BOOST_MEM_FN_CC __cdecl
1.59 +
1.60 +#include <boost/bind/mem_fn_template.hpp>
1.61 +
1.62 +#undef BOOST_MEM_FN_CC
1.63 +#undef BOOST_MEM_FN_NAME
1.64 +
1.65 +#endif
1.66 +
1.67 +#ifdef BOOST_MEM_FN_ENABLE_STDCALL
1.68 +
1.69 +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
1.70 +#define BOOST_MEM_FN_CC __stdcall
1.71 +
1.72 +#include <boost/bind/mem_fn_template.hpp>
1.73 +
1.74 +#undef BOOST_MEM_FN_CC
1.75 +#undef BOOST_MEM_FN_NAME
1.76 +
1.77 +#endif
1.78 +
1.79 +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1.80 +
1.81 +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
1.82 +#define BOOST_MEM_FN_CC __fastcall
1.83 +
1.84 +#include <boost/bind/mem_fn_template.hpp>
1.85 +
1.86 +#undef BOOST_MEM_FN_CC
1.87 +#undef BOOST_MEM_FN_NAME
1.88 +
1.89 +#endif
1.90 +
1.91 +#undef BOOST_MEM_FN_RETURN
1.92 +
1.93 +}; // struct mf<V>
1.94 +
1.95 +template<> struct mf<void>
1.96 +{
1.97 +
1.98 +#define BOOST_MEM_FN_RETURN
1.99 +
1.100 +#define BOOST_MEM_FN_NAME(X) inner_##X
1.101 +#define BOOST_MEM_FN_CC
1.102 +
1.103 +#include <boost/bind/mem_fn_template.hpp>
1.104 +
1.105 +#undef BOOST_MEM_FN_CC
1.106 +#undef BOOST_MEM_FN_NAME
1.107 +
1.108 +#ifdef BOOST_MEM_FN_ENABLE_CDECL
1.109 +
1.110 +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
1.111 +#define BOOST_MEM_FN_CC __cdecl
1.112 +
1.113 +#include <boost/bind/mem_fn_template.hpp>
1.114 +
1.115 +#undef BOOST_MEM_FN_CC
1.116 +#undef BOOST_MEM_FN_NAME
1.117 +
1.118 +#endif
1.119 +
1.120 +#ifdef BOOST_MEM_FN_ENABLE_STDCALL
1.121 +
1.122 +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
1.123 +#define BOOST_MEM_FN_CC __stdcall
1.124 +
1.125 +#include <boost/bind/mem_fn_template.hpp>
1.126 +
1.127 +#undef BOOST_MEM_FN_CC
1.128 +#undef BOOST_MEM_FN_NAME
1.129 +
1.130 +#endif
1.131 +
1.132 +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1.133 +
1.134 +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
1.135 +#define BOOST_MEM_FN_CC __fastcall
1.136 +
1.137 +#include <boost/bind/mem_fn_template.hpp>
1.138 +
1.139 +#undef BOOST_MEM_FN_CC
1.140 +#undef BOOST_MEM_FN_NAME
1.141 +
1.142 +#endif
1.143 +
1.144 +#undef BOOST_MEM_FN_RETURN
1.145 +
1.146 +}; // struct mf<void>
1.147 +
1.148 +#undef BOOST_MEM_FN_CLASS_F
1.149 +#undef BOOST_MEM_FN_TYPEDEF_F
1.150 +
1.151 +#define BOOST_MEM_FN_NAME(X) X
1.152 +#define BOOST_MEM_FN_NAME2(X) inner_##X
1.153 +#define BOOST_MEM_FN_CC
1.154 +
1.155 +#include <boost/bind/mem_fn_vw.hpp>
1.156 +
1.157 +#undef BOOST_MEM_FN_NAME
1.158 +#undef BOOST_MEM_FN_NAME2
1.159 +#undef BOOST_MEM_FN_CC
1.160 +
1.161 +#ifdef BOOST_MEM_FN_ENABLE_CDECL
1.162 +
1.163 +#define BOOST_MEM_FN_NAME(X) X##_cdecl
1.164 +#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
1.165 +#define BOOST_MEM_FN_CC __cdecl
1.166 +
1.167 +#include <boost/bind/mem_fn_vw.hpp>
1.168 +
1.169 +#undef BOOST_MEM_FN_NAME
1.170 +#undef BOOST_MEM_FN_NAME2
1.171 +#undef BOOST_MEM_FN_CC
1.172 +
1.173 +#endif
1.174 +
1.175 +#ifdef BOOST_MEM_FN_ENABLE_STDCALL
1.176 +
1.177 +#define BOOST_MEM_FN_NAME(X) X##_stdcall
1.178 +#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall
1.179 +#define BOOST_MEM_FN_CC __stdcall
1.180 +
1.181 +#include <boost/bind/mem_fn_vw.hpp>
1.182 +
1.183 +#undef BOOST_MEM_FN_NAME
1.184 +#undef BOOST_MEM_FN_NAME2
1.185 +#undef BOOST_MEM_FN_CC
1.186 +
1.187 +#endif
1.188 +
1.189 +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1.190 +
1.191 +#define BOOST_MEM_FN_NAME(X) X##_fastcall
1.192 +#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall
1.193 +#define BOOST_MEM_FN_CC __fastcall
1.194 +
1.195 +#include <boost/bind/mem_fn_vw.hpp>
1.196 +
1.197 +#undef BOOST_MEM_FN_NAME
1.198 +#undef BOOST_MEM_FN_NAME2
1.199 +#undef BOOST_MEM_FN_CC
1.200 +
1.201 +#endif
1.202 +
1.203 +} // namespace _mfi
1.204 +
1.205 +#else // #ifdef BOOST_NO_VOID_RETURNS
1.206 +
1.207 +#define BOOST_MEM_FN_CLASS_F
1.208 +#define BOOST_MEM_FN_TYPEDEF(X) typedef X;
1.209 +
1.210 +namespace _mfi
1.211 +{
1.212 +
1.213 +#define BOOST_MEM_FN_RETURN return
1.214 +
1.215 +#define BOOST_MEM_FN_NAME(X) X
1.216 +#define BOOST_MEM_FN_CC
1.217 +
1.218 +#include <boost/bind/mem_fn_template.hpp>
1.219 +
1.220 +#undef BOOST_MEM_FN_CC
1.221 +#undef BOOST_MEM_FN_NAME
1.222 +
1.223 +#ifdef BOOST_MEM_FN_ENABLE_CDECL
1.224 +
1.225 +#define BOOST_MEM_FN_NAME(X) X##_cdecl
1.226 +#define BOOST_MEM_FN_CC __cdecl
1.227 +
1.228 +#include <boost/bind/mem_fn_template.hpp>
1.229 +
1.230 +#undef BOOST_MEM_FN_CC
1.231 +#undef BOOST_MEM_FN_NAME
1.232 +
1.233 +#endif
1.234 +
1.235 +#ifdef BOOST_MEM_FN_ENABLE_STDCALL
1.236 +
1.237 +#define BOOST_MEM_FN_NAME(X) X##_stdcall
1.238 +#define BOOST_MEM_FN_CC __stdcall
1.239 +
1.240 +#include <boost/bind/mem_fn_template.hpp>
1.241 +
1.242 +#undef BOOST_MEM_FN_CC
1.243 +#undef BOOST_MEM_FN_NAME
1.244 +
1.245 +#endif
1.246 +
1.247 +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1.248 +
1.249 +#define BOOST_MEM_FN_NAME(X) X##_fastcall
1.250 +#define BOOST_MEM_FN_CC __fastcall
1.251 +
1.252 +#include <boost/bind/mem_fn_template.hpp>
1.253 +
1.254 +#undef BOOST_MEM_FN_CC
1.255 +#undef BOOST_MEM_FN_NAME
1.256 +
1.257 +#endif
1.258 +
1.259 +#undef BOOST_MEM_FN_RETURN
1.260 +
1.261 +} // namespace _mfi
1.262 +
1.263 +#undef BOOST_MEM_FN_CLASS_F
1.264 +#undef BOOST_MEM_FN_TYPEDEF
1.265 +
1.266 +#endif // #ifdef BOOST_NO_VOID_RETURNS
1.267 +
1.268 +#define BOOST_MEM_FN_NAME(X) X
1.269 +#define BOOST_MEM_FN_CC
1.270 +
1.271 +#include <boost/bind/mem_fn_cc.hpp>
1.272 +
1.273 +#undef BOOST_MEM_FN_NAME
1.274 +#undef BOOST_MEM_FN_CC
1.275 +
1.276 +#ifdef BOOST_MEM_FN_ENABLE_CDECL
1.277 +
1.278 +#define BOOST_MEM_FN_NAME(X) X##_cdecl
1.279 +#define BOOST_MEM_FN_CC __cdecl
1.280 +
1.281 +#include <boost/bind/mem_fn_cc.hpp>
1.282 +
1.283 +#undef BOOST_MEM_FN_NAME
1.284 +#undef BOOST_MEM_FN_CC
1.285 +
1.286 +#endif
1.287 +
1.288 +#ifdef BOOST_MEM_FN_ENABLE_STDCALL
1.289 +
1.290 +#define BOOST_MEM_FN_NAME(X) X##_stdcall
1.291 +#define BOOST_MEM_FN_CC __stdcall
1.292 +
1.293 +#include <boost/bind/mem_fn_cc.hpp>
1.294 +
1.295 +#undef BOOST_MEM_FN_NAME
1.296 +#undef BOOST_MEM_FN_CC
1.297 +
1.298 +#endif
1.299 +
1.300 +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1.301 +
1.302 +#define BOOST_MEM_FN_NAME(X) X##_fastcall
1.303 +#define BOOST_MEM_FN_CC __fastcall
1.304 +
1.305 +#include <boost/bind/mem_fn_cc.hpp>
1.306 +
1.307 +#undef BOOST_MEM_FN_NAME
1.308 +#undef BOOST_MEM_FN_CC
1.309 +
1.310 +#endif
1.311 +
1.312 +// data member support
1.313 +
1.314 +namespace _mfi
1.315 +{
1.316 +
1.317 +template<class R, class T> class dm
1.318 +{
1.319 +public:
1.320 +
1.321 + typedef R const & result_type;
1.322 + typedef T const * argument_type;
1.323 +
1.324 +private:
1.325 +
1.326 + typedef R (T::*F);
1.327 + F f_;
1.328 +
1.329 + template<class U> R const & call(U & u, T const *) const
1.330 + {
1.331 + return (u.*f_);
1.332 + }
1.333 +
1.334 + template<class U> R const & call(U & u, void const *) const
1.335 + {
1.336 + return (get_pointer(u)->*f_);
1.337 + }
1.338 +
1.339 +public:
1.340 +
1.341 + explicit dm(F f): f_(f) {}
1.342 +
1.343 + R & operator()(T * p) const
1.344 + {
1.345 + return (p->*f_);
1.346 + }
1.347 +
1.348 + R const & operator()(T const * p) const
1.349 + {
1.350 + return (p->*f_);
1.351 + }
1.352 +
1.353 + template<class U> R const & operator()(U const & u) const
1.354 + {
1.355 + return call(u, &u);
1.356 + }
1.357 +
1.358 +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
1.359 +
1.360 + R & operator()(T & t) const
1.361 + {
1.362 + return (t.*f_);
1.363 + }
1.364 +
1.365 + R const & operator()(T const & t) const
1.366 + {
1.367 + return (t.*f_);
1.368 + }
1.369 +
1.370 +#endif
1.371 +
1.372 + bool operator==(dm const & rhs) const
1.373 + {
1.374 + return f_ == rhs.f_;
1.375 + }
1.376 +
1.377 + bool operator!=(dm const & rhs) const
1.378 + {
1.379 + return f_ != rhs.f_;
1.380 + }
1.381 +};
1.382 +
1.383 +} // namespace _mfi
1.384 +
1.385 +template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f)
1.386 +{
1.387 + return _mfi::dm<R, T>(f);
1.388 +}
1.389 +
1.390 +} // namespace boost
1.391 +
1.392 +#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED