summaryrefslogtreecommitdiff
path: root/libs/bind/doc/bind/implementation.qbk
blob: 40d339ada48eb65232bc004423f07d78c4b8f96a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[/
 /  Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
 /  Copyright (c) 2003-2008 Peter Dimov
 /
 / Distributed under the Boost Software License, Version 1.0. (See
 / accompanying file LICENSE_1_0.txt or copy at
 / http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:implementation Implementation]

[section Files]

* [@../../include/boost/bind.hpp boost/bind.hpp] (main header)
* [@../../include/boost/bind/bind_cc.hpp boost/bind/bind_cc.hpp] (used by `bind.hpp`, do not include directly)
* [@../../include/boost/bind/bind_mf_cc.hpp boost/bind/bind_mf_cc.hpp] (used by `bind.hpp`, do not include directly)
* [@../../include/boost/bind/bind_template.hpp boost/bind/bind_template.hpp] (used by `bind.hpp`, do not include directly)
* [@../../include/boost/bind/arg.hpp boost/bind/arg.hpp] (defines the type of the placeholder arguments)
* [@../../include/boost/bind/placeholders.hpp boost/bind/placeholders.hpp] (defines the `_1`, `_2`, ... `_9` placeholders)
* [@../../include/boost/bind/apply.hpp boost/bind/apply.hpp] (`apply` helper function object)
* [@../../include/boost/bind/protect.hpp boost/bind/protect.hpp] (`protect` helper function)
* [@../../include/boost/bind/make_adaptable.hpp boost/bind/make_adaptable.hpp] (`make_adaptable` helper function)
* [@../../test/bind_test.cpp libs/bind/test/bind_test.cpp] (test)
* [@../../bind_as_compose.cpp libs/bind/bind_as_compose.cpp] (function composition example)
* [@../../bind_visitor.cpp libs/bind/bind_visitor.cpp] (visitor example)
* [@../../test/bind_stdcall_test.cpp libs/bind/test/bind_stdcall_test.cpp] (test with `__stdcall` functions)
* [@../../test/bind_stdcall_mf_test.cpp libs/bind/test/bind_stdcall_mf_test.cpp] (test with `__stdcall` member functions)
* [@../../test/bind_fastcall_test.cpp libs/bind/test/bind_fastcall_test.] (test with `__fastcall` functions)
* [@../../test/bind_fastcall_mf_test.cpp libs/bind/test/bind_fastcall_mf_test.cpp] (test with `__fastcall` member functions)

[endsect]

[section Dependencies]

* [@boost:/libs/config/config.htm Boost.Config]
* [@boost:/libs/core/doc/html/core/ref.html boost/ref.hpp]
* [@boost:/libs/bind/mem_fn.html boost/mem_fn.hpp]
* [@boost:/boost/type.hpp boost/type.hpp]

[endsect]

[section Number of Arguments]

This implementation supports function objects with up to nine arguments. This
is an implementation detail, not an inherent limitation of the design.

[endsect]

[section:stdcall `__stdcall`, `__cdecl`, `__fastcall`, and `pascal` Support]

Some platforms allow several types of (member) functions that differ by their
calling convention (the rules by which the function is invoked: how are
arguments passed, how is the return value handled, and who cleans up the stack
 - if any.)

For example, Windows API functions and COM interface member functions use a
calling convention known as `__stdcall`. Borland VCL components use
`__fastcall`. Mac toolbox functions use a `pascal` calling convention.

To use `bind` with `__stdcall` functions, `#define` the macro
`BOOST_BIND_ENABLE_STDCALL` before including `<boost/bind.hpp>`.

To use `bind` with `__stdcall` member functions, `#define` the macro
`BOOST_MEM_FN_ENABLE_STDCALL` before including `<boost/bind.hpp>`.

To use `bind` with `__fastcall` functions, `#define` the macro
`BOOST_BIND_ENABLE_FASTCALL` before including `<boost/bind.hpp>`.

To use `bind` with `__fastcall` member functions, `#define` the macro
`BOOST_MEM_FN_ENABLE_FASTCALL` before including `<boost/bind.hpp>`.

To use `bind` with `pascal` functions, `#define` the macro
`BOOST_BIND_ENABLE_PASCAL` before including `<boost/bind.hpp>`.

To use `bind` with `__cdecl` member functions, `#define` the macro
`BOOST_MEM_FN_ENABLE_CDECL` before including `<boost/bind.hpp>`.

[*It is best to define these macros in the project options, via `-D` on the
command line, or as the first line in the translation unit (.cpp file) where
`bind` is used.] Not following this rule can lead to obscure errors when a
header includes `bind.hpp` before the macro has been defined.

/[Note:/ this is a non-portable extension. It is not part of the interface./]/

/[Note:/ Some compilers provide only minimal support for the `__stdcall` keyword./]/

[endsect]

[section `visit_each` support]

Function objects returned by `bind` support the experimental and undocumented,
as of yet, `visit_each` enumeration interface.

See [@../../bind_visitor.cpp bind_visitor.cpp] for an example.

[endsect]

[endsect]