Brian Silverman | ce4aa8d | 2018-08-04 23:36:03 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. |
| 3 | / Copyright (c) 2003-2008 Peter Dimov |
| 4 | / |
| 5 | / Distributed under the Boost Software License, Version 1.0. (See |
| 6 | / accompanying file LICENSE_1_0.txt or copy at |
| 7 | / http://www.boost.org/LICENSE_1_0.txt) |
| 8 | /] |
| 9 | |
| 10 | [section:implementation Implementation] |
| 11 | |
| 12 | [section Files] |
| 13 | |
| 14 | * [@../../../../boost/bind.hpp boost/bind.hpp] (main header) |
| 15 | * [@../../../../boost/bind/bind_cc.hpp boost/bind/bind_cc.hpp] (used by `bind.hpp`, do not include directly) |
| 16 | * [@../../../../boost/bind/bind_mf_cc.hpp boost/bind/bind_mf_cc.hpp] (used by `bind.hpp`, do not include directly) |
| 17 | * [@../../../../boost/bind/bind_template.hpp boost/bind/bind_template.hpp] (used by `bind.hpp`, do not include directly) |
| 18 | * [@../../../../boost/bind/arg.hpp boost/bind/arg.hpp] (defines the type of the placeholder arguments) |
| 19 | * [@../../../../boost/bind/placeholders.hpp boost/bind/placeholders.hpp] (defines the `_1`, `_2`, ... `_9` placeholders) |
| 20 | * [@../../../../boost/bind/apply.hpp boost/bind/apply.hpp] (`apply` helper function object) |
| 21 | * [@../../../../boost/bind/protect.hpp boost/bind/protect.hpp] (`protect` helper function) |
| 22 | * [@../../../../boost/bind/make_adaptable.hpp boost/bind/make_adaptable.hpp] (`make_adaptable` helper function) |
| 23 | * [@../../test/bind_test.cpp libs/bind/test/bind_test.cpp] (test) |
| 24 | * [@../../bind_as_compose.cpp libs/bind/bind_as_compose.cpp] (function composition example) |
| 25 | * [@../../bind_visitor.cpp libs/bind/bind_visitor.cpp] (visitor example) |
| 26 | * [@../../test/bind_stdcall_test.cpp libs/bind/test/bind_stdcall_test.cpp] (test with `__stdcall` functions) |
| 27 | * [@../../test/bind_stdcall_mf_test.cpp libs/bind/test/bind_stdcall_mf_test.cpp] (test with `__stdcall` member functions) |
| 28 | * [@../../test/bind_fastcall_test.cpp libs/bind/test/bind_fastcall_test.] (test with `__fastcall` functions) |
| 29 | * [@../../test/bind_fastcall_mf_test.cpp libs/bind/test/bind_fastcall_mf_test.cpp] (test with `__fastcall` member functions) |
| 30 | |
| 31 | [endsect] |
| 32 | |
| 33 | [section Dependencies] |
| 34 | |
| 35 | * [@boost:/libs/config/config.htm Boost.Config] |
| 36 | * [@boost:/libs/core/doc/html/core/ref.html boost/ref.hpp] |
| 37 | * [@boost:/libs/bind/mem_fn.html boost/mem_fn.hpp] |
| 38 | * [@boost:/boost/type.hpp boost/type.hpp] |
| 39 | |
| 40 | [endsect] |
| 41 | |
| 42 | [section Number of Arguments] |
| 43 | |
| 44 | This implementation supports function objects with up to nine arguments. This |
| 45 | is an implementation detail, not an inherent limitation of the design. |
| 46 | |
| 47 | [endsect] |
| 48 | |
| 49 | [section:stdcall `__stdcall`, `__cdecl`, `__fastcall`, and `pascal` Support] |
| 50 | |
| 51 | Some platforms allow several types of (member) functions that differ by their |
| 52 | calling convention (the rules by which the function is invoked: how are |
| 53 | arguments passed, how is the return value handled, and who cleans up the stack |
| 54 | - if any.) |
| 55 | |
| 56 | For example, Windows API functions and COM interface member functions use a |
| 57 | calling convention known as `__stdcall`. Borland VCL components use |
| 58 | `__fastcall`. Mac toolbox functions use a `pascal` calling convention. |
| 59 | |
| 60 | To use `bind` with `__stdcall` functions, `#define` the macro |
| 61 | `BOOST_BIND_ENABLE_STDCALL` before including `<boost/bind.hpp>`. |
| 62 | |
| 63 | To use `bind` with `__stdcall` member functions, `#define` the macro |
| 64 | `BOOST_MEM_FN_ENABLE_STDCALL` before including `<boost/bind.hpp>`. |
| 65 | |
| 66 | To use `bind` with `__fastcall` functions, `#define` the macro |
| 67 | `BOOST_BIND_ENABLE_FASTCALL` before including `<boost/bind.hpp>`. |
| 68 | |
| 69 | To use `bind` with `__fastcall` member functions, `#define` the macro |
| 70 | `BOOST_MEM_FN_ENABLE_FASTCALL` before including `<boost/bind.hpp>`. |
| 71 | |
| 72 | To use `bind` with `pascal` functions, `#define` the macro |
| 73 | `BOOST_BIND_ENABLE_PASCAL` before including `<boost/bind.hpp>`. |
| 74 | |
| 75 | To use `bind` with `__cdecl` member functions, `#define` the macro |
| 76 | `BOOST_MEM_FN_ENABLE_CDECL` before including `<boost/bind.hpp>`. |
| 77 | |
| 78 | [*It is best to define these macros in the project options, via `-D` on the |
| 79 | command line, or as the first line in the translation unit (.cpp file) where |
| 80 | `bind` is used.] Not following this rule can lead to obscure errors when a |
| 81 | header includes `bind.hpp` before the macro has been defined. |
| 82 | |
| 83 | /[Note:/ this is a non-portable extension. It is not part of the interface./]/ |
| 84 | |
| 85 | /[Note:/ Some compilers provide only minimal support for the `__stdcall` keyword./]/ |
| 86 | |
| 87 | [endsect] |
| 88 | |
| 89 | [section `visit_each` support] |
| 90 | |
| 91 | Function objects returned by `bind` support the experimental and undocumented, |
| 92 | as of yet, `visit_each` enumeration interface. |
| 93 | |
| 94 | See [@../../bind_visitor.cpp bind_visitor.cpp] for an example. |
| 95 | |
| 96 | [endsect] |
| 97 | |
| 98 | [endsect] |