srb2::MobjListView: relax constraint so basic mobj_t is allowed

This commit is contained in:
James R 2023-12-03 09:51:22 -08:00
parent 4588943352
commit df5d1e5fb5

View file

@ -14,15 +14,17 @@
#include <iterator> #include <iterator>
#include <type_traits> #include <type_traits>
#include "mobj.hpp" #include "p_mobj.h"
namespace srb2 namespace srb2
{ {
// for (T* ptr : MobjList(hnext(), [](T* ptr) { return ptr->hnext(); })) // for (T* ptr : MobjList(hnext(), [](T* ptr) { return ptr->hnext(); }))
template <typename T, typename F, std::enable_if_t<std::is_convertible_v<T, Mobj>, bool> = true> template <typename T, typename F>
struct MobjListView struct MobjListView
{ {
static_assert(std::is_convertible_v<T, mobj_t>);
struct Iterator struct Iterator
{ {
using iterator_category = std::forward_iterator_tag; using iterator_category = std::forward_iterator_tag;