| Home | Libraries | People | FAQ | More

## Class template wrapping_int2

boost::date_time::wrapping_int2 —

A wrapping integer used to wrap around at the top.

## Synopsis

    template<typename int_type_, int_type_ wrap_min, int_type_ wrap_max>
    class wrapping_int2 {
    public:
      // types
      typedef int_type_ int_type;

      // construct/copy/destruct
      wrapping_int2(int_type);

      // public member functions
      int_type as_int() const;
      operator int_type() const;
      int_type add(int_type) ;
      int_type subtract(int_type) ;

      // public static functions
      unsigned long wrap_value() ;
      unsigned long min_value() ;
    };

## Description

Bad name, quick impl to fix a bug -- fix later!! This allows the wrap to restart at a value other than 0. Currently this only works if wrap_min == 1

### `wrapping_int2` construct/copy/destruct

1.     wrapping_int2(int_type v);

   If initializing value is out of range of [wrap_min, wrap_max], value will be initialized to closest of min or max

### `wrapping_int2` public member functions

1.     int_type as_int() const;

   Explicit converion method.

2.     operator int_type() const;

3.     int_type add(int_type v) ;

   Add, return number of wraps performed.

4.     int_type subtract(int_type v) ;

   Subtract will return '-d' if wrapping took place ('d' is the number of wraps).

### `wrapping_int2` public static functions

1.     unsigned long wrap_value() ;

2.     unsigned long min_value() ;

| Copyright © 2001-2004 CrystalClear Software, Inc