Function set

Summary

#include <include/flecs/addons/cpp/world.hpp>

(1) template <typename T, if_t< !is_callable< T >::value > = 0>
    void set(const T &value) const

(2) template <typename T, if_t< !is_callable< T >::value > = 0>
    void set(T &&value) const

(3) template <typename Func, if_t< is_callable< Func >::value > = 0>
    void set(const Func &func)

Function overload

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, if_t< !is_callable< T >::value > = 0>
void set(const T &value) const

Description

Set singleton component.

Mentioned in

Source

Lines 514-517 in include/flecs/addons/cpp/world.hpp.

template <typename T, if_t< !is_callable<T>::value > = 0>
void set(const T& value) const {
    flecs::set<T>(m_world, _::cpp_type<T>::id(m_world), value);
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename T, if_t< !is_callable< T >::value > = 0>
void set(T &&value) const

Description

No description yet.

Mentioned in

Source

Lines 519-523 in include/flecs/addons/cpp/world.hpp.

template <typename T, if_t< !is_callable<T>::value > = 0>
void set(T&& value) const {
    flecs::set<T>(m_world, _::cpp_type<T>::id(m_world), 
        FLECS_FWD(value));
}

Synopsis

#include <include/flecs/addons/cpp/world.hpp>

template <typename Func, if_t< is_callable< Func >::value > = 0>
void set(const Func &func)

Description

Set singleton component inside a callback.

Mentioned in

Source

Lines 132-137 in include/flecs/addons/cpp/impl/world.hpp. Line 528 in include/flecs/addons/cpp/world.hpp.

template <typename Func, if_t< is_callable<Func>::value > >
void world::set(const Func& func) {
    static_assert(arity<Func>::value == 1, "singleton component must be the only argument");
    _::entity_with_invoker<Func>::invoke_get_mut(
        this->m_world, this->singleton<first_arg_t<Func>>(), func);
}