2 #ifndef vbl_array_1d_h_ 3 #define vbl_array_1d_h_ 19 # include <vcl_msvc_warnings.h> 48 std::ptrdiff_t n = e - b;
51 begin_ = (T*)
operator new( n *
sizeof(T) );
54 for (std::ptrdiff_t i=0; i<n; ++i)
65 begin_ = (T*)
operator new( n *
sizeof(T) );
82 for ( ; i!=
end_ && j!=that.
end_; ++i, ++j)
83 if (!(*i == *j))
return false;
101 T *new_begin_ = (T*)
operator new( new_n *
sizeof(T) );
102 T *new_end_ = new_begin_ + n;
103 T *new_alloc_ = new_begin_ + new_n;
105 for (std::ptrdiff_t i=0; i<n; ++i) {
106 new (new_begin_ + i) T(
begin_[i]);
110 operator delete(
begin_ );
171 #endif // vbl_array_1d_h_
T const & const_reference
size_type capacity() const
reference operator[](std::ptrdiff_t i)
Get the ith element.
vbl_array_1d(size_type n, const T &v)
Construct an array with n elements, all equal to v.
vbl_array_1d(vbl_array_1d< T > const &that)
void push_back(T const &x)
const_reference front() const
const_reference back() const
vbl_array_1d(const_iterator b, const_iterator e)
const_reference operator[](std::ptrdiff_t i) const
Get the ith element.
const_iterator begin() const
const_iterator end() const
void reserve(std::ptrdiff_t new_n)
std::ostream & operator<<(std::ostream &, vbl_array_1d< T > const &)
vbl_array_1d< T > & operator=(vbl_array_1d< T > const &that)
bool operator==(vbl_array_1d< T > const &that) const