Function meta_construct

Summary

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

(1) template <typename Type, typename... Args>
    meta_any meta_construct(meta_any *const args)

(2) template <typename Type, typename Policy = as_is_t, typename Candidate>
    meta_any meta_construct(Candidate &&candidate, meta_any *const args)

(3) template <typename Type, auto Candidate, typename Policy = as_is_t>
    meta_any meta_construct(meta_any *const args)

Function overload

Synopsis

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

template <typename Type, typename... Args>
meta_any meta_construct(meta_any *const args)

Description

Tries to construct an instance given a list of erased parameters.

Template Parameters

Type - Actual type of the instance to construct.

Args - Types of arguments expected.

Parameters

args - Parameters to use to construct the instance.

Returns
A meta any containing the new instance, if any.

Source

Lines 358-361 in src/entt/meta/utility.hpp.

template<typename Type, typename... Args>
[[nodiscard]] meta_any meta_construct(meta_any *const args) {
    return internal::meta_construct<Type, Args...>(args, std::index_sequence_for<Args...>{});
}

Synopsis

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

template <typename Type, typename Policy = as_is_t, typename Candidate>
meta_any meta_construct(Candidate &&candidate, meta_any *const args)

Description

Tries to construct an instance given a list of erased parameters.

Template Parameters

Type - Reflected type to which the object to invoke is associated.

Policy - Optional policy (no policy set by default).

Candidate - The type of the actual object to invoke.

Parameters

args - Parameters to use to invoke the object.

candidate - The actual object to invoke.

Returns
A meta any containing the returned value, if any.

Source

Lines 372-379 in src/entt/meta/utility.hpp.

template<typename Type, typename Policy = as_is_t, typename Candidate>
[[nodiscard]] meta_any meta_construct(Candidate &&candidate, meta_any *const args) {
    if constexpr(meta_function_helper_t<Type, Candidate>::is_static) {
        return internal::meta_invoke<Type, Policy>({}, std::forward<Candidate>(candidate), args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<Candidate>>::args_type::size>{});
    } else {
        return internal::meta_invoke<Type, Policy>(*args, std::forward<Candidate>(candidate), args + 1u, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<Candidate>>::args_type::size>{});
    }
}

Synopsis

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

template <typename Type, auto Candidate, typename Policy = as_is_t>
meta_any meta_construct(meta_any *const args)

Description

Tries to construct an instance given a list of erased parameters.

Template Parameters

Type - Reflected type to which the function is associated.

Candidate - The actual function to invoke.

Policy - Optional policy (no policy set by default).

Parameters

args - Parameters to use to invoke the function.

Returns
A meta any containing the returned value, if any.

Source

Lines 389-392 in src/entt/meta/utility.hpp.

template<typename Type, auto Candidate, typename Policy = as_is_t>
[[nodiscard]] meta_any meta_construct(meta_any *const args) {
    return meta_construct<Type, Policy>(Candidate, args);
}





Add Discussion

Log in to comment