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:limitations Limitations]
11
12As a general rule, the function objects generated by `bind` take their
13arguments by reference and cannot, therefore, accept non-const temporaries or
14literal constants. This is an inherent limitation of the C++ language in its
15current (2003) incarnation, known as the [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm forwarding problem].
16(It will be fixed in the next standard, usually called C++0x.)
17
18The library uses signatures of the form
19
20    template<class T> void f(T & t);
21
22to accept arguments of arbitrary types and pass them on unmodified. As noted,
23this does not work with non-const r-values.
24
25On compilers that support partial ordering of function templates, a possible
26solution is to add an overload:
27
28    template<class T> void f(T & t);
29    template<class T> void f(T const & t);
30
31Unfortunately, this requires providing 512 overloads for nine arguments, which
32is impractical. The library chooses a small subset: for up to two arguments,
33it provides the const overloads in full, for arities of three and more it
34provides a single additional overload with all of the arguments taken by const
35reference. This covers a reasonable portion of the use cases.
36
37[endsect]
38