Struct identity

Synopsis

#include <src/entt/core/utility.hpp>

struct identity

Description

Identity function object (waiting for C++20).

Mentioned in

Methods

operator()Returns its argument unchanged.

Source

Lines 10-24 in src/entt/core/utility.hpp.

struct identity {
    /*! @brief Indicates that this is a transparent function object. */
    using is_transparent = void;

    /**
     * @brief Returns its argument unchanged.
     * @tparam Type Type of the argument.
     * @param value The actual argument.
     * @return The submitted value as-is.
     */
    template<class Type>
    [[nodiscard]] constexpr Type &&operator()(Type &&value) const ENTT_NOEXCEPT {
        return std::forward<Type>(value);
    }
};





Add Discussion

Log in to comment