diff --git a/bind.html b/bind.html index dee6dd6..c113a4f 100644 --- a/bind.html +++ b/bind.html @@ -12,7 +12,7 @@
- ![]() ![]() |
bind.hpp@@ -23,17 +23,48 @@ |
boost::bind is a generalization of the standard functions @@ -45,7 +76,7 @@ in particular, it does not need the result_type, first_argument_type and second_argument_type standard typedefs.
-Given these definitions: @@ -139,7 +170,7 @@ int i = 5; bind(f, ref(i), _1); -
bind is not limited to functions; it accepts arbitrary function objects. @@ -177,7 +208,7 @@ bind(std::less<int>, _1, 9)(x); // x < 9 [Note: the ability to omit the return type is not available on all compilers.]
-Pointers to member functions are not function objects, because they do not @@ -244,7 +275,7 @@ the function object retains a reference to its instance of X and will remain valid even when p goes out of scope or is reset().
-Some of the arguments passed to bind may be nested bind expressions @@ -289,7 +320,9 @@ int main() } -
class image; @@ -322,7 +355,7 @@ void render(image & target) }-
class button @@ -350,7 +383,7 @@ void connect() }-
The function objects generated by bind take their arguments by @@ -394,9 +427,95 @@ partially ordered. corresponding issue has not been resolved yet.]
-+See the dedicated Troubleshooting section. +
+ ++Probably because you used the general bind<R>(f, ...) syntax, thereby +instructing bind to not "inspect" f to detect arity +and return type errors. +
+ ++The first form instructs bind to inspect the type of f in order +to determine its arity (number of arguments) and return type. Arity errors +will be detected at "bind time". This syntax, of course, places some +requirements on f. It must be a function, function pointer, member +function pointer, or a function object that defines a nested type named +result_type; in short, it must be something that bind can +recognize. +
+ ++The second form instructs bind to not attempt to recognize the +type of f. It is generally used with function objects that do not, or +cannot, expose result_type, but it can also be used with nonstandard +functions. For example, the current implementation does not automatically +recognize variable-argument functions like printf, so you will have to +use bind<int>(printf, ...). +
+ ++Another important factor to consider is that compilers without partial template +specialization or function template partial ordering support cannot handle the +first form when f is a function object, and in most cases will not handle +the second form when f is a function (pointer) or a member function pointer. +
+ ++Yes, if you #define BOOST_BIND_ENABLE_STDCALL. +An alternative is to treat the function as a +generic function object and use the +bind<R>(f, ...) syntax. +
+ ++Yes, if you #define BOOST_MEM_FN_ENABLE_STDCALL. +
+ ++Yes, if you #define BOOST_BIND_ENABLE_PASCAL. +An alternative is to treat the function as a +generic function object and use the +bind<R>(f, ...) syntax. +
+ ++Non-portable extensions, in general, should default to off to prevent vendor +lock-in. Had the appropriate macros been defined +automatically, you could +have accidentally taken advantage of them without realizing that your code is, +perhaps, no longer portable. In addition, some compilers have the option to +make __stdcall their default calling convention, in which case no +separate support would be necessary. +
+ ++This section is still under development. +
+ +namespace boost @@ -452,7 +571,7 @@ namespace }-
All implementation-defined-N types returned by bind are @@ -465,7 +584,7 @@ All implementation-defined-placeholder-N types are CopyConstructible. Their copy constructors do not throw exceptions.
-The function µ(x, v1, v2, ..., vm), where m is a nonnegative integer, is defined as: @@ -481,7 +600,7 @@ when x is (a copy of) a function object returned by bind; -
This implementation supports function objects with up to nine arguments. @@ -600,7 +741,7 @@ This is an implementation detail, not an inherent limitation of the design.
-Some platforms allow several types of (member) functions that differ by their @@ -611,7 +752,8 @@ stack - if any.)
For example, Windows API functions and COM interface member functions use a -calling convention known as __stdcall. +calling convention known as __stdcall. Mac toolbox functions use a +pascal calling convention.
@@ -624,6 +766,11 @@ To use bind with __stdcall member functions, #define macro BOOST_MEM_FN_ENABLE_STDCALL before including <boost/bind.hpp>.
++To use bind with pascal functions, #define the macro +BOOST_BIND_ENABLE_PASCAL before including <boost/bind.hpp>. +
+[Note: this is a non-portable extension. It is not part of the interface.]
@@ -632,7 +779,7 @@ macro BOOST_MEM_FN_ENABLE_STDCALL before including <boost/bind.hpp& [Note: Some compilers provide only minimal support for the __stdcall keyword.] -Microsoft Visual C++ (up to version 7.0) does not fully support the @@ -673,33 +820,18 @@ interface, and is not guaranteed to work on other compilers, or persist between library versions. In short, don't use it unless you absolutely have to.]
--[Note: this is an experimental feature. It may evolve over time -when other libraries start to exploit it; or it may be removed altogether if -no other library needs it. It is not part of the interface.] -
+-For better integration with other libraries, the function objects returned by -bind define a member function -
- --template<class Visitor> void accept(Visitor & v); -- -
-that applies v, as a function object, to its internal state. Using -accept is implementation-specific and not intended for end users. +Function objects returned by bind support the experimental and +undocumented, as of yet, visit_each enumeration interface.
See bind_visitor.cpp for an example.
-Earlier efforts that have influenced the library design: diff --git a/mem_fn.html b/mem_fn.html index 7c977dc..5d0f58a 100644 --- a/mem_fn.html +++ b/mem_fn.html @@ -12,7 +12,7 @@
- ![]() ![]() |
mem_fn.hpp@@ -31,7 +31,7 @@ std::mem_fun[_ref] adaptors?Should I replace every occurence of std::mem_fun[_ref] with mem_fn in my existing code?-Will mem_fn work with COM methods?+Does mem_fn work with COM methods?Why isn't BOOST_MEM_FN_ENABLE_STDCALL defined automatically?InterfaceSynopsis@@ -42,7 +42,7 @@ with mem_fn in my existing code?FilesDependenciesNumber of Arguments-__stdcall Support+"__stdcall" SupportAcknowledgementsPurpose@@ -196,7 +196,7 @@ that need adaptable function objects in order to function might not like mem_fn. -Will mem_fn work with COM methods?+Does mem_fn work with COM methods?
Yes, if you #define BOOST_MEM_FN_ENABLE_STDCALL.
@@ -352,7 +352,7 @@ is of type T [const], (get_pointer(t)->*pmf)(a1, a2)libs/bind/mem_fn_void_test.cpp (test for void returns)
- __stdcall Support+"__stdcall" SupportSome platforms allow several types of member functions that differ by their |