Struct resource_loader

Synopsis

#include <src/entt/resource/loader.hpp>

template<typename Type>
struct resource_loader

Description

Transparent loader for shared resources.

Template Parameters

Type - Type of resources created by the loader.

Methods

operator()Constructs a shared pointer to a resource from its arguments.

Source

Lines 14-29 in src/entt/resource/loader.hpp.

template<typename Type>
struct resource_loader {
    /*! @brief Result type. */
    using result_type = std::shared_ptr<Type>;

    /**
     * @brief Constructs a shared pointer to a resource from its arguments.
     * @tparam Args Types of arguments to use to construct the resource.
     * @param args Parameters to use to construct the resource.
     * @return A shared pointer to a resource of the given type.
     */
    template<typename... Args>
    result_type operator()(Args &&...args) const {
        return std::make_shared<Type>(std::forward<Args>(args)...);
    }
};





Add Discussion

Log in to comment