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

[#bind_front]
# <boost/compat/bind_front.hpp>
:idprefix: ref_bind_front_

## Description

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

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

## Example

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

int main()
{
    X x;
    auto fn = boost::compat::bind_front(&X::f, &x);

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

## Synopsis

```
namespace boost
{
namespace compat
{

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

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

## bind_front

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

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