diff options
Diffstat (limited to 'src/generic')
-rw-r--r-- | src/generic/array.hpp | 9 | ||||
-rw-r--r-- | src/generic/fwd.hpp | 16 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/generic/array.hpp b/src/generic/array.hpp index dccb91e..3575db6 100644 --- a/src/generic/array.hpp +++ b/src/generic/array.hpp @@ -26,6 +26,7 @@ #include "oops.hpp" +// half the important stuff is now in fwd.hpp !!! namespace tmwa { template<class I, I be, I en> @@ -39,9 +40,6 @@ struct ExclusiveIndexing constexpr static size_t alloc_size = index_to_offset(en) - index_to_offset(be); }; -template<size_t n> -using SimpleIndexing = ExclusiveIndexing<size_t, 0, n>; - template<class I, I lo, I hi> struct InclusiveIndexing { @@ -53,7 +51,7 @@ struct InclusiveIndexing constexpr static size_t alloc_size = index_to_offset(hi) - index_to_offset(lo) + 1; }; -template<class E, E n=E::COUNT> +template<class E, E n> struct EnumIndexing : ExclusiveIndexing<E, static_cast<E>(0), n> { }; @@ -112,7 +110,4 @@ public: return !(lhs == rhs); } }; - -template<class T, size_t n> -using Array = GenericArray<T, SimpleIndexing<n>>; } // namespace tmwa diff --git a/src/generic/fwd.hpp b/src/generic/fwd.hpp index 2517d62..0527290 100644 --- a/src/generic/fwd.hpp +++ b/src/generic/fwd.hpp @@ -39,4 +39,20 @@ template<class K, class V> class UPMap; class InternPool; + +// arrays are complicated +template<class I, I be, I en> +struct ExclusiveIndexing; +template<size_t n> +using SimpleIndexing = ExclusiveIndexing<size_t, 0, n>; +template<class I, I lo, I hi> +struct InclusiveIndexing; +template<class E, E n=E::COUNT> +struct EnumIndexing; +template<class I, size_t limit> +struct InventoryIndexing; +template<class T, class I> +struct GenericArray; +template<class T, size_t n> +using Array = GenericArray<T, SimpleIndexing<n>>; } // namespace tmwa |