From 15c0c2f789902ac764919913e123466ac46e4746 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <clyne@bitgloo.com> Date: Thu, 12 Oct 2023 20:23:50 -0400 Subject: some class refactoring --- libalee/types.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libalee/types.hpp') diff --git a/libalee/types.hpp b/libalee/types.hpp index 95daee6..4d86c5d 100644 --- a/libalee/types.hpp +++ b/libalee/types.hpp @@ -23,7 +23,7 @@ #include <iterator> /** - * Configure the below three types to match your platform. + * Configure the below types for your platform. */ using Addr = uint16_t; using Cell = int16_t; @@ -48,13 +48,16 @@ enum class Error : int { }; /** - * Stores the start and (past-the-)end addresses of a dictionary's word. + * Stores the start and past-the-end addresses of a dictionary's word. */ -struct Word +class Word { Addr start; Addr wend; +public: + struct iterator; + constexpr explicit Word(Addr s = 0, Addr e = 0): start(s), wend(e) {} @@ -64,8 +67,6 @@ struct Word Addr size() const noexcept; - // Iterators provided for std::equal. - struct iterator; iterator begin(const Dictionary *); iterator end(const Dictionary *); @@ -83,6 +84,7 @@ struct Word addr(a), dict(d) {} iterator& operator++(); + iterator operator++(int); value_type operator*(); bool operator!=(const iterator&); }; -- cgit v1.2.3