3 Defines `boost::hana::id`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FUNCTIONAL_ID_HPP
11 #define BOOST_HANA_FUNCTIONAL_ID_HPP
13 #include <boost/hana/config.hpp>
16 BOOST_HANA_NAMESPACE_BEGIN
17 //! @ingroup group-functional
18 //! The identity function -- returns its argument unchanged.
21 //! @include example/functional/id.cpp
22 #ifdef BOOST_HANA_DOXYGEN_INVOKED
23 constexpr auto id = [](auto&& x) -> decltype(auto) {
29 constexpr T operator()(T&& t) const {
30 return static_cast<T&&>(t);
36 BOOST_HANA_NAMESPACE_END
38 #endif // !BOOST_HANA_FUNCTIONAL_ID_HPP