46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
|
<title>Boost Function Object Adapter Library</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1>Identity</h1>
|
||
|
<p>The header <a href="../../boost/functional/identity.hpp">
|
||
|
<boost/functional/identity.hpp></a> provides the function object
|
||
|
<code>boost::identity</code> whose <code>operator()</code> returns its
|
||
|
argument. It is an implementation of C++20's <code>std::identity</code>
|
||
|
that supports C++03 and above.</p>
|
||
|
<h2>Example</h2>
|
||
|
<p>It is commonly used as the default projection in constrained algorithms.</p>
|
||
|
<pre>
|
||
|
<code>template<class Range, class Projection = boost::identity>
|
||
|
void print(Range&& range, Projection projection = {});</code>
|
||
|
</pre>
|
||
|
<h2>Reference</h2>
|
||
|
<pre>
|
||
|
<code>namespace boost {
|
||
|
|
||
|
struct identity {
|
||
|
using is_transparent = <em>unspecified</em>;
|
||
|
|
||
|
template<class T>
|
||
|
T&& operator()(T&& value) const noexcept;
|
||
|
};
|
||
|
|
||
|
} // boost</code>
|
||
|
</pre>
|
||
|
<h3>Operators</h3>
|
||
|
<dl>
|
||
|
<dt><code>template<class T>
|
||
|
T&& operator()(T&& value) const noexcept;</code></dt>
|
||
|
<dd>Returns <code>std::forward<T>(value)</code></dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
<p>Copyright 2021 Glen Joseph Fernandes.</p>
|
||
|
<p>Distributed under the
|
||
|
<a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License,
|
||
|
Version 1.0</a>.</p>
|
||
|
</body>
|
||
|
</html>
|