@@ -118,7 +118,7 @@ namespace geode
118118 " on HorizonsStack will be empty: top and bottom "
119119 " horizons have not been computed, or stack is empty." );
120120 }
121- return { *this , true };
121+ return { *this , RANGEORDER ::bottom_to_top };
122122 }
123123
124124 template < index_t dimension >
@@ -132,7 +132,7 @@ namespace geode
132132 " on HorizonsStack will be empty: top and bottom "
133133 " horizons have not been computed, or stack is empty" );
134134 }
135- return { *this , true };
135+ return { *this , RANGEORDER ::bottom_to_top };
136136 }
137137
138138 template < index_t dimension >
@@ -146,7 +146,7 @@ namespace geode
146146 " on HorizonsStack will be empty: top and bottom "
147147 " horizons have not been computed, or stack is empty." );
148148 }
149- return { *this , false };
149+ return { *this , RANGEORDER ::top_to_bottom };
150150 }
151151
152152 template < index_t dimension >
@@ -160,7 +160,7 @@ namespace geode
160160 " on HorizonsStack will be empty: top and bottom "
161161 " horizons have not been computed, or stack is empty" );
162162 }
163- return { *this , false };
163+ return { *this , RANGEORDER ::top_to_bottom };
164164 }
165165
166166 template < index_t dimension >
@@ -234,15 +234,21 @@ namespace geode
234234 class HorizonsStack < dimension >::HorizonOrderedRange::Impl
235235 {
236236 public:
237- Impl ( const HorizonsStack< dimension >& stack, bool bottom_to_top )
238- : stack_( stack ), bottom_to_top_( bottom_to_top )
237+ Impl ( const HorizonsStack< dimension >& stack, RANGEORDER range_order )
238+ : stack_( stack ), range_order_( range_order )
239239 {
240240 auto bot_horizon = stack.bottom_horizon ();
241241 auto top_horizon = stack.top_horizon ();
242242 if ( bot_horizon && top_horizon )
243243 {
244- iter_ =
245- bottom_to_top_ ? bot_horizon.value () : top_horizon.value ();
244+ if ( range_order_ == RANGEORDER ::bottom_to_top )
245+ {
246+ iter_ = bot_horizon.value ();
247+ }
248+ else if ( range_order_ == RANGEORDER ::top_to_bottom )
249+ {
250+ iter_ = top_horizon.value ();
251+ }
246252 }
247253 }
248254
@@ -253,7 +259,7 @@ namespace geode
253259
254260 void operator ++()
255261 {
256- if ( bottom_to_top_ )
262+ if ( range_order_ == RANGEORDER ::bottom_to_top )
257263 {
258264 if ( iter_ != stack_.top_horizon ().value () )
259265 {
@@ -262,7 +268,7 @@ namespace geode
262268 return ;
263269 }
264270 }
265- else
271+ else if ( range_order_ == RANGEORDER ::top_to_bottom )
266272 {
267273 if ( iter_ != stack_.bottom_horizon ().value () )
268274 {
@@ -281,13 +287,13 @@ namespace geode
281287
282288 private:
283289 const HorizonsStack< dimension >& stack_;
284- bool bottom_to_top_ ;
290+ RANGEORDER range_order_ ;
285291 uuid iter_{};
286292 };
287293
288294 template < index_t dimension >
289295 HorizonsStack< dimension >::HorizonOrderedRange::HorizonOrderedRange(
290- const HorizonsStack& horizons_stack, bool bottom_to_top )
296+ const HorizonsStack& horizons_stack, RANGEORDER bottom_to_top )
291297 : impl_( horizons_stack, bottom_to_top )
292298 {
293299 }
@@ -331,16 +337,21 @@ namespace geode
331337 class HorizonsStack < dimension >::StratigraphicUnitOrderedRange::Impl
332338 {
333339 public:
334- Impl ( const HorizonsStack< dimension >& stack, bool bottom_to_top )
335- : stack_( stack ), bottom_to_top_( bottom_to_top )
340+ Impl ( const HorizonsStack< dimension >& stack, RANGEORDER range_order )
341+ : stack_( stack ), range_order_( range_order )
336342 {
337343 auto bot_horizon = stack.bottom_horizon ();
338344 auto top_horizon = stack.top_horizon ();
339345 if ( bot_horizon && top_horizon )
340346 {
341- iter_ = bottom_to_top_
342- ? stack.under ( bot_horizon.value () ).value ()
343- : stack.above ( top_horizon.value () ).value ();
347+ if ( range_order_ == RANGEORDER ::bottom_to_top )
348+ {
349+ iter_ = stack.under ( bot_horizon.value () ).value ();
350+ }
351+ else if ( range_order_ == RANGEORDER ::top_to_bottom )
352+ {
353+ iter_ = stack.above ( top_horizon.value () ).value ();
354+ }
344355 }
345356 }
346357
@@ -351,7 +362,7 @@ namespace geode
351362
352363 void operator ++()
353364 {
354- if ( bottom_to_top_ )
365+ if ( range_order_ == RANGEORDER ::bottom_to_top )
355366 {
356367 if ( iter_
357368 != stack_.above ( stack_.top_horizon ().value () ).value () )
@@ -361,7 +372,7 @@ namespace geode
361372 return ;
362373 }
363374 }
364- else
375+ else if ( range_order_ == RANGEORDER ::top_to_bottom )
365376 {
366377 if ( iter_
367378 != stack_.under ( stack_.bottom_horizon ().value () ).value () )
@@ -381,14 +392,14 @@ namespace geode
381392
382393 private:
383394 const HorizonsStack< dimension >& stack_;
384- bool bottom_to_top_ ;
395+ RANGEORDER range_order_ ;
385396 uuid iter_{};
386397 };
387398
388399 template < index_t dimension >
389400 HorizonsStack< dimension >::StratigraphicUnitOrderedRange::
390401 StratigraphicUnitOrderedRange (
391- const HorizonsStack& horizons_stack, bool bottom_to_top )
402+ const HorizonsStack& horizons_stack, RANGEORDER bottom_to_top )
392403 : impl_( horizons_stack, bottom_to_top )
393404 {
394405 }
0 commit comments