66 */
77#pragma once
88
9- #include " ../snapshot_impl .h"
9+ #include " ../snapshot_interface .h"
1010
1111#include < system.h>
1212#include < traits.h>
@@ -102,15 +102,15 @@ class restorable : public snapshot_interface
102102 }
103103
104104 // Checks if we have a save state
105- bool is_saved () const { return _save != ~0 ; }
105+ bool is_saved () const { return _save != ~0U ; }
106106
107107 // Creates a save point which can later be restored to or forgotten
108108 void save ()
109109 {
110110 inkAssert (
111- _save == ~0 , " Collection is already saved. You should never call save twice. Ignoring."
111+ _save == ~0U , " Collection is already saved. You should never call save twice. Ignoring."
112112 );
113- if (_save != ~0 ) {
113+ if (_save != ~0U ) {
114114 return ;
115115 }
116116
@@ -121,8 +121,8 @@ class restorable : public snapshot_interface
121121 // Restore to the last save point
122122 void restore ()
123123 {
124- inkAssert (_save != ~0 , " Collection can't be restored because it's not saved. Ignoring." );
125- if (_save == ~0 ) {
124+ inkAssert (_save != ~0U , " Collection can't be restored because it's not saved. Ignoring." );
125+ if (_save == ~0U ) {
126126 return ;
127127 }
128128
@@ -137,8 +137,8 @@ class restorable : public snapshot_interface
137137 template <typename NullifyMethod>
138138 void forget (NullifyMethod nullify)
139139 {
140- inkAssert (_save != ~0 , " Can't forget save point because there is none. Ignoring." );
141- if (_save == ~0 ) {
140+ inkAssert (_save != ~0U , " Can't forget save point because there is none. Ignoring." );
141+ if (_save == ~0U ) {
142142 return ;
143143 }
144144
@@ -170,7 +170,7 @@ class restorable : public snapshot_interface
170170 ElementType& push (const ElementType& elem)
171171 {
172172 // Don't destroy saved data. Jump over it
173- if (_pos < _save && _save != ~0 ) {
173+ if (_pos < _save && _save != ~0U ) {
174174 _jump = _pos;
175175 _pos = _save;
176176 }
@@ -279,7 +279,7 @@ class restorable : public snapshot_interface
279279 void for_each_all (CallbackMethod callback) const
280280 {
281281 // no matter if we're saved or not, we iterate everything
282- int len = (_save == ~0 || _pos > _save) ? _pos : _save;
282+ int len = (_save == ~0U || _pos > _save) ? _pos : _save;
283283
284284 // Iterate
285285 for (int i = 0 ; i < len; i++)
@@ -358,10 +358,7 @@ class restorable : public snapshot_interface
358358
359359protected:
360360 // Called when we run out of space in buffer.
361- virtual void overflow (ElementType*&, size_t &)
362- {
363- inkFail (" Restorable run out of memory!" );
364- }
361+ virtual void overflow (ElementType*&, size_t &) { inkFail (" Restorable run out of memory!" ); }
365362
366363private:
367364 template <typename Predicate>
0 commit comments