This file is indexed.

/usr/include/boost/polygon/interval_concept.hpp is in libboost1.46-dev 1.46.1-7ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
/*
  Copyright 2008 Intel Corporation
 
  Use, modification and distribution are subject to the Boost Software License,
  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
*/
#ifndef BOOST_POLYGON_INTERVAL_CONCEPT_HPP
#define BOOST_POLYGON_INTERVAL_CONCEPT_HPP
#include "isotropy.hpp"
#include "interval_data.hpp"
#include "interval_traits.hpp"

namespace boost { namespace polygon{
  struct interval_concept {};
 
  template <typename T>
  struct is_interval_concept { typedef gtl_no type; };
  template <>
  struct is_interval_concept<interval_concept> { typedef gtl_yes type; };

  template <typename T>
  struct is_mutable_interval_concept { typedef gtl_no type; };
  template <>
  struct is_mutable_interval_concept<interval_concept> { typedef gtl_yes type; };

  template <typename T, typename CT>
  struct interval_coordinate_type_by_concept { typedef void type; };
  template <typename T>
  struct interval_coordinate_type_by_concept<T, gtl_yes> { typedef typename interval_traits<T>::coordinate_type type; };

  template <typename T>
  struct interval_coordinate_type {
      typedef typename interval_coordinate_type_by_concept<
            T, typename is_interval_concept<typename geometry_concept<T>::type>::type>::type type;
  };

  template <typename T, typename CT>
  struct interval_difference_type_by_concept { typedef void type; };
  template <typename T>
  struct interval_difference_type_by_concept<T, gtl_yes> { 
    typedef typename coordinate_traits<typename interval_traits<T>::coordinate_type>::coordinate_difference type; };

  template <typename T>
  struct interval_difference_type {
      typedef typename interval_difference_type_by_concept<
            T, typename is_interval_concept<typename geometry_concept<T>::type>::type>::type type;
  };


  template <typename T>
  typename interval_coordinate_type<T>::type
  get(const T& interval, direction_1d dir,
  typename enable_if<typename gtl_if<typename is_interval_concept<typename geometry_concept<T>::type>::type>::type>::type * = 0
  ) {
    return interval_traits<T>::get(interval, dir); 
  }

  template <typename T, typename coordinate_type>
  void 
  set(T& interval, direction_1d dir, coordinate_type value,
  typename enable_if<typename is_mutable_interval_concept<typename geometry_concept<T>::type>::type>::type * = 0
  ) {
    //this may need to be refined
    interval_mutable_traits<T>::set(interval, dir, value); 
    if(high(interval) < low(interval))
      interval_mutable_traits<T>::set(interval, dir.backward(), value);
  }
  
  template <typename T, typename T2, typename T3>
  T
  construct(T2 low_value, T3 high_value,
            typename enable_if<typename is_mutable_interval_concept<typename geometry_concept<T>::type>::type>::type * = 0
  ) {
    if(low_value > high_value) std::swap(low_value, high_value);
    return interval_mutable_traits<T>::construct(low_value, high_value); 
  }
  
  template <typename T, typename T2>
  T
  copy_construct(const T2& interval,
  typename enable_if< typename gtl_and<typename is_mutable_interval_concept<typename geometry_concept<T>::type>::type,
  typename is_interval_concept<typename geometry_concept<T2>::type>::type>::type>::type * = 0
  ) {
    return construct<T>
      (get(interval, LOW ),
       get(interval, HIGH));
  }

  template <typename T1, typename T2>
  T1 &
  assign(T1& lvalue, const T2& rvalue,
  typename enable_if< typename gtl_and< typename is_mutable_interval_concept<typename geometry_concept<T1>::type>::type,
  typename is_interval_concept<typename geometry_concept<T2>::type>::type>::type>::type * = 0) {
    lvalue = copy_construct<T1>(rvalue);
    return lvalue;
  }

  template <typename T, typename T2>
  bool 
  equivalence(const T& interval1, const T2& interval2,
  typename enable_if< typename gtl_and< typename is_interval_concept<typename geometry_concept<T>::type>::type,
  typename is_interval_concept<typename geometry_concept<T2>::type>::type>::type>::type * = 0
  ) {
    return get(interval1, LOW) ==
      get(interval2, LOW) &&
      get(interval1, HIGH) ==
      get(interval2, HIGH); 
  }
  
  struct y_i_contains : gtl_yes {};

  template <typename interval_type>
  typename enable_if< typename gtl_and< y_i_contains, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type >::type, bool>::type 
  contains(const interval_type& interval,
           typename interval_traits<interval_type>::coordinate_type value, 
           bool consider_touch = true ) {
    if(consider_touch) {
      return value <= high(interval) && value >= low(interval);
    } else {
      return value < high(interval) && value > low(interval);
    }
  }
  
  template <typename interval_type, typename interval_type_2>
  bool 
  contains(const interval_type& interval,
           const interval_type_2& value, bool consider_touch = true,
           typename enable_if< typename gtl_and< typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
           typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type>::type * = 0
           ) {
    return contains(interval, get(value, LOW), consider_touch) &&
      contains(interval, get(value, HIGH), consider_touch);
  }
  
  // get the low coordinate
  template <typename interval_type>
  typename interval_traits<interval_type>::coordinate_type 
  low(const interval_type& interval,
  typename enable_if< typename is_interval_concept<typename geometry_concept<interval_type>::type>::type>::type * = 0
  ) { return get(interval, LOW); }

  // get the high coordinate
  template <typename interval_type>
  typename interval_traits<interval_type>::coordinate_type 
  high(const interval_type& interval,
  typename enable_if< typename is_interval_concept<typename geometry_concept<interval_type>::type>::type>::type * = 0
  ) { return get(interval, HIGH); }

  // get the center coordinate
  template <typename interval_type>
  typename interval_traits<interval_type>::coordinate_type
  center(const interval_type& interval,
  typename enable_if< typename is_interval_concept<typename geometry_concept<interval_type>::type>::type>::type * = 0
  ) { return (high(interval) + low(interval))/2; }


  struct y_i_low : gtl_yes {};

  // set the low coordinate to v
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_low, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, void>::type 
  low(interval_type& interval,
      typename interval_traits<interval_type>::coordinate_type v) { set(interval, LOW, v); }
  
  struct y_i_high : gtl_yes {};

  // set the high coordinate to v
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_high, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, void>::type 
  high(interval_type& interval,
      typename interval_traits<interval_type>::coordinate_type v) { set(interval, HIGH, v); }
  
  // get the magnitude of the interval
  template <typename interval_type>
  typename interval_difference_type<interval_type>::type 
  delta(const interval_type& interval,
  typename enable_if< typename is_interval_concept<typename geometry_concept<interval_type>::type>::type>::type * = 0
  ) { 
    typedef typename coordinate_traits<typename interval_traits<interval_type>::coordinate_type>::coordinate_difference diffT;
    return (diffT)high(interval) - (diffT)low(interval); }

  struct y_i_flip : gtl_yes {};

  // flip this about coordinate
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_flip, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  flip(interval_type& interval,
       typename interval_traits<interval_type>::coordinate_type axis = 0) {
    typename interval_traits<interval_type>::coordinate_type newLow, newHigh;
    newLow  = 2 * axis - high(interval);
    newHigh = 2 * axis - low(interval);
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }

  struct y_i_scale_up : gtl_yes {};

  // scale interval by factor
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_scale_up, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  scale_up(interval_type& interval, 
           typename coordinate_traits<typename interval_traits<interval_type>::coordinate_type>::unsigned_area_type factor) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newHigh = high(interval) * (Unit)factor;
    low(interval, low(interval) * (Unit)factor);
    high(interval, (newHigh));
    return interval;
  }

  struct y_i_scale_down : gtl_yes {};

  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_scale_down, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  scale_down(interval_type& interval, 
             typename coordinate_traits<typename interval_traits<interval_type>::coordinate_type>::unsigned_area_type factor) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    typedef typename coordinate_traits<Unit>::coordinate_distance dt;
    Unit newHigh = scaling_policy<Unit>::round((dt)(high(interval)) / (dt)factor); 
    low(interval, scaling_policy<Unit>::round((dt)(low(interval)) / (dt)factor)); 
    high(interval, (newHigh));
    return interval;
  }

  struct y_i_scale : gtl_yes {};

  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_scale, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  scale(interval_type& interval, double factor) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newHigh = scaling_policy<Unit>::round((double)(high(interval)) * factor);
    low(interval, scaling_policy<Unit>::round((double)low(interval)* factor));
    high(interval, (newHigh));
    return interval;
  }
  
  // move interval by delta
  template <typename interval_type>
  interval_type&
  move(interval_type& interval,
       typename interval_difference_type<interval_type>::type displacement,
       typename enable_if<typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type * = 0
       ) {
    typedef typename interval_traits<interval_type>::coordinate_type ctype;
    typedef typename coordinate_traits<ctype>::coordinate_difference Unit;
    Unit len = delta(interval);
    low(interval, static_cast<ctype>(static_cast<Unit>(low(interval)) + displacement));
    high(interval, static_cast<ctype>(static_cast<Unit>(low(interval)) + len));
    return interval;
  }
  
  struct y_i_convolve : gtl_yes {};

  // convolve this with b
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_convolve, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  convolve(interval_type& interval,
           typename interval_traits<interval_type>::coordinate_type b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval) + b;
    Unit newHigh = high(interval) + b;
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }

  struct y_i_deconvolve : gtl_yes {};

  // deconvolve this with b
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_deconvolve, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type &
  deconvolve(interval_type& interval,
             typename interval_traits<interval_type>::coordinate_type b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval)  - b;
    Unit newHigh = high(interval) - b;
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }

  struct y_i_convolve2 : gtl_yes {};

  // convolve this with b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_convolve2,
                       typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type, 
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    interval_type>::type &
  convolve(interval_type& interval,
           const interval_type_2& b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval)  + low(b);
    Unit newHigh = high(interval) + high(b);
    low(interval, newLow);
                         high(interval, newHigh);
                         return interval;
  }
  
  struct y_i_deconvolve2 : gtl_yes {};

  // deconvolve this with b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3< y_i_deconvolve2,
                        typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
                        typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    interval_type>::type &
  deconvolve(interval_type& interval,
             const interval_type_2& b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval)  - low(b);
    Unit newHigh = high(interval) - high(b);
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }
  
  struct y_i_reconvolve : gtl_yes {};

  // reflected convolve this with b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_reconvolve,
                       typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    interval_type>::type &
  reflected_convolve(interval_type& interval,
                     const interval_type_2& b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval)  - high(b);
    Unit newHigh = high(interval) - low(b);
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }
  
  struct y_i_redeconvolve : gtl_yes {};

  // reflected deconvolve this with b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3< y_i_redeconvolve,
                        typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type, 
                        typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type, 
    interval_type>::type &
  reflected_deconvolve(interval_type& interval,
                       const interval_type_2& b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit newLow  = low(interval)  + high(b);
    Unit newHigh = high(interval) + low(b);
    low(interval, newLow);
    high(interval, newHigh);
    return interval;
  }
  
  struct y_i_e_dist1 : gtl_yes {};

  // distance from a coordinate to an interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_e_dist1, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       typename interval_difference_type<interval_type>::type>::type
  euclidean_distance(const interval_type& interval,
                     typename interval_traits<interval_type>::coordinate_type position) {
    typedef typename coordinate_traits<typename interval_traits<interval_type>::coordinate_type>::coordinate_difference Unit;
    Unit dist[3] = {0, (Unit)low(interval) - (Unit)position, (Unit)position - (Unit)high(interval)};
    return dist[ (dist[1] > 0) + ((dist[2] > 0) << 1) ];
  }

  struct y_i_e_dist2 : gtl_yes {};
  
  // distance between two intervals
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_e_dist2, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    typename interval_difference_type<interval_type>::type>::type
  euclidean_distance(const interval_type& interval,
                     const interval_type_2& b) {
    typedef typename coordinate_traits<typename interval_traits<interval_type>::coordinate_type>::coordinate_difference Unit;
    Unit dist[3] = {0, (Unit)low(interval) - (Unit)high(b), (Unit)low(b) - (Unit)high(interval)};
    return dist[ (dist[1] > 0) + ((dist[2] > 0) << 1) ];
  }
  
  struct y_i_e_intersects : gtl_yes {};

  // check if Interval b intersects `this` Interval
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_e_intersects, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    bool>::type 
    intersects(const interval_type& interval, const interval_type_2& b, 
               bool consider_touch = true) {
                         return consider_touch ? 
                           (low(interval) <= high(b)) & (high(interval) >= low(b)) :
                           (low(interval) < high(b)) & (high(interval) > low(b));
  }

  struct y_i_e_bintersect : gtl_yes {};

  // check if Interval b partially overlaps `this` Interval
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_e_bintersect, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    bool>::type 
  boundaries_intersect(const interval_type& interval, const interval_type_2& b, 
                       bool consider_touch = true) {
    return (contains(interval, low(b), consider_touch) || 
            contains(interval, high(b), consider_touch)) &&
      (contains(b, low(interval), consider_touch) || 
       contains(b, high(interval), consider_touch));
  }

  struct y_i_abuts1 : gtl_yes {};

  // check if they are end to end
  template <typename interval_type, typename interval_type_2>
  typename enable_if< typename gtl_and_3<y_i_abuts1, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
                                         typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
                       bool>::type 
  abuts(const interval_type& interval, const interval_type_2& b, direction_1d dir) {
    return dir.to_int() ? low(b) == high(interval) : low(interval) == high(b);
  }

  struct y_i_abuts2 : gtl_yes {};

  // check if they are end to end
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_abuts2, typename is_interval_concept<typename geometry_concept<interval_type>::type>::type,
                       typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    bool>::type 
  abuts(const interval_type& interval, const interval_type_2& b) {
    return abuts(interval, b, HIGH) || abuts(interval, b, LOW);
  } 

  struct y_i_intersect : gtl_yes {};

  // set 'this' interval to the intersection of 'this' and b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< typename gtl_and_3<y_i_intersect, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
                                         typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
                       bool>::type 
  intersect(interval_type& interval, const interval_type_2& b, bool consider_touch = true) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit lowVal = (std::max)(low(interval), low(b));
    Unit highVal = (std::min)(high(interval), high(b));
    bool valid = consider_touch ?
      lowVal <= highVal :
      lowVal < highVal;
    if(valid) {
      low(interval, lowVal);
      high(interval, highVal);
    }
    return valid;
  }

  struct y_i_g_intersect : gtl_yes {};

  // set 'this' interval to the generalized intersection of 'this' and b
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_g_intersect, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
                      typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    interval_type>::type &
  generalized_intersect(interval_type& interval, const interval_type_2& b) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit coords[4] = {low(interval), high(interval), low(b), high(b)};
    //consider implementing faster sorting of small fixed length range
    gtlsort(coords, coords+4);
    low(interval, coords[1]);
    high(interval, coords[2]);
    return interval;
  }

  struct y_i_bloat : gtl_yes {};

  // bloat the Interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_bloat, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       interval_type>::type &
  bloat(interval_type& interval, typename interval_traits<interval_type>::coordinate_type bloating) {
    low(interval, low(interval)-bloating);
    high(interval, high(interval)+bloating);
    return interval;
  }
  
  struct y_i_bloat2 : gtl_yes {};

  // bloat the specified side of `this` Interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_bloat2, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       interval_type>::type &
  bloat(interval_type& interval, direction_1d dir, typename interval_traits<interval_type>::coordinate_type bloating) {
    set(interval, dir, get(interval, dir) + dir.get_sign() * bloating);
    return interval;
  }

  struct y_i_shrink : gtl_yes {};

  // shrink the Interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_shrink, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       interval_type>::type &
  shrink(interval_type& interval, typename interval_traits<interval_type>::coordinate_type shrinking) {
    return bloat(interval, -shrinking);
  }

  struct y_i_shrink2 : gtl_yes {};

  // shrink the specified side of `this` Interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_shrink2, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       interval_type>::type &
  shrink(interval_type& interval, direction_1d dir, typename interval_traits<interval_type>::coordinate_type shrinking) {
    return bloat(interval, dir, -shrinking);
  }

  // Enlarge `this` Interval to encompass the specified Interval
  template <typename interval_type, typename interval_type_2>
  bool
  encompass(interval_type& interval, const interval_type_2& b,
  typename enable_if<
    typename gtl_and< typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
            typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type>::type * = 0
  ) {
    bool retval = !contains(interval, b, true);
    low(interval, (std::min)(low(interval), low(b)));
    high(interval, (std::max)(high(interval), high(b)));
    return retval;
  }    

  struct y_i_encompass : gtl_yes {};

  // Enlarge `this` Interval to encompass the specified Interval
  template <typename interval_type>
  typename enable_if< typename gtl_and<y_i_encompass, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type,
                       bool>::type
  encompass(interval_type& interval, typename interval_traits<interval_type>::coordinate_type b) {
    bool retval = !contains(interval, b, true);
    low(interval, (std::min)(low(interval), b));
    high(interval, (std::max)(high(interval), b));
    return retval;
  }    

  struct y_i_get_half : gtl_yes {};

  // gets the half of the interval as an interval
  template <typename interval_type>
  typename enable_if<typename gtl_and<y_i_get_half, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type>::type, interval_type>::type 
  get_half(const interval_type& interval, direction_1d d1d) {
    typedef typename interval_traits<interval_type>::coordinate_type Unit;
    Unit c = (get(interval, LOW) + get(interval, HIGH)) / 2;
    return construct<interval_type>((d1d == LOW) ? get(interval, LOW) : c,
                                    (d1d == LOW) ? c : get(interval, HIGH));
  }

  struct y_i_join_with : gtl_yes {};

  // returns true if the 2 intervals exactly touch at one value, like in  l1 <= h1 == l2 <= h2
  // sets the argument to the joined interval
  template <typename interval_type, typename interval_type_2>
  typename enable_if< 
    typename gtl_and_3<y_i_join_with, typename is_mutable_interval_concept<typename geometry_concept<interval_type>::type>::type,
                      typename is_interval_concept<typename geometry_concept<interval_type_2>::type>::type>::type,
    bool>::type 
  join_with(interval_type& interval, const interval_type_2& b) {
    if(abuts(interval, b)) {
      encompass(interval, b);
      return true;
    }
    return false;
  }

  template <class T>
  template <class T2>
  interval_data<T>& interval_data<T>::operator=(const T2& rvalue) {
    assign(*this, rvalue);
    return *this;
  }

  template <typename T>
  struct geometry_concept<interval_data<T> > {
    typedef interval_concept type;
  };
}
}
#endif