////
Copyright 2024 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://www.boost.org/LICENSE_1_0.txt
////

[#bind_back]
# <boost/compat/bind_back.hpp>
:idprefix: ref_bind_back_

## Description

The header `<boost/compat/bind_back.hpp>` implements the {cpp}20 function
`std::bind_back`.

`bind_back` is a limited variant of `std::bind`. It only supports binding
the last several parameters of a function object to specific argument values.

## Example

```
struct X
{
    void f(int a, int b) const noexcept;
};

int main()
{
    auto fn = boost::compat::bind_back(&X::f, 1, 2);

    X x;
    fn(x); // calls x.f(1, 2)
}
```

## Synopsis

```
namespace boost
{
namespace compat
{

template<class F, class... A> auto bind_back(F&& f, A&&... a);

} // namespace compat
} // namespace boost
```

## bind_back

```
template<class F, class... A> auto bind_back( F&& f, A&&... a );
```

[horizontal]
Returns:;; A function object `fn` such that `fn(b...)` is equivalent to
  `invoke(f, b..., a...)`.
