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 13-24 in src/entt/core/utility.hpp.

struct identity {
    /**
     * @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