home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_05
/
1105084a
< prev
next >
Wrap
Text File
|
1993-03-16
|
970b
|
56 lines
// fv2.h - a dynamic vector of float (with a possibly
// non-zero low-bound) using a subscripting object
// implemented by aggregation with a float_array member
#include "fa1.h"
class float_vector
{
public:
float_vector(int lo = 0, int hi = 0);
float operator[](int i) const;
fa_index operator[](int i);
size_t length() const;
int low() const;
int high() const;
operator float_array &();
operator const float_array &() const;
private:
float_array fa;
int _low;
};
inline float_vector::float_vector(int lo, int hi)
: _low(lo), fa(hi - lo + 1)
{ }
inline size_t float_vector::length() const
{
return fa.length();
}
inline int float_vector::low() const
{
return _low;
}
inline int float_vector::high() const
{
return _low + fa.length() - 1;
}
inline float_vector::operator float_array &()
{
return fa;
}
inline
float_vector::operator const float_array &() const
{
return fa;
}