Function operator|

Synopsis

#include <src/entt/entity/view.hpp>

template <typename Entity, typename... ELhs, typename... CLhs, typename... ERhs, typename... CRhs>
auto operator|(const basic_view< Entity, exclude_t< ELhs... >, CLhs... > &lhs, const basic_view< Entity, exclude_t< ERhs... >, CRhs... > &rhs)

Description

Combines two views in a more specific one.

Template Parameters

Entity - A valid entity type (see entt_traits for more details).

ELhs - Filter list of the first view.

CLhs - Component list of the first view.

ERhs - Filter list of the second view.

CRhs - Component list of the second view.

Parameters

lhs - A valid reference to the first view.

rhs - A valid reference to the second view.

Returns
A more specific view.

Source

Lines 1046-1050 in src/entt/entity/view.hpp.

template<typename Entity, typename... ELhs, typename... CLhs, typename... ERhs, typename... CRhs>
[[nodiscard]] auto operator|(const basic_view<Entity, exclude_t<ELhs...>, CLhs...> &lhs, const basic_view<Entity, exclude_t<ERhs...>, CRhs...> &rhs) {
    using view_type = basic_view<Entity, exclude_t<ELhs..., ERhs...>, CLhs..., CRhs...>;
    return std::apply([](auto *... storage) { return view_type{*storage...}; }, std::tuple_cat(lhs.pools, rhs.pools, lhs.filter, rhs.filter));
}





Add Discussion

Log in to comment