The vbs tools - vbs_ls, vbs_rm, vbs_fs - for listing, removing and mounting vbs and Mark6 format scattered VLBI recordings on FlexBuff and Mark6 systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
900 B

#ifndef AUTO_ARRAY_H
#define AUTO_ARRAY_H
#include <sys/types.h>
template <typename T>
struct auto_array {
public:
typedef T element_type;
auto_array() :
m_ptr( 0 )
{}
auto_array(T* const p):
m_ptr( p )
{}
auto_array(const auto_array<T>& other):
m_ptr( other.m_ptr )
{ other.m_ptr = 0; }
auto_array<T>& operator=(const auto_array<T>& other) {
if( this!=&other ) {
m_ptr = other.m_ptr;
other.m_ptr = 0;
}
return *this;
}
T& operator[](size_t idx) {
return m_ptr[idx];
}
T const& operator[](size_t idx) const {
return m_ptr[idx];
}
~auto_array() {
delete [] m_ptr;
}
private:
element_type* m_ptr;
};
#endif