diff --git a/include/uarray.h b/include/uarray.h index b5e4d0f..568921f 100644 --- a/include/uarray.h +++ b/include/uarray.h @@ -47,6 +47,14 @@ public: inline bool empty (void) const { return (N == 0); } inline const_reference at (size_type i) const { return (_v[i]); } inline reference at (size_type i) { return (_v[i]); } + + + inline const_reference front (void) const { return (_v[0]); } + inline reference front (void) { return (_v[0]); } + inline const_reference back (void) const { return (_v[N-1]); } + inline reference back (void) { return (_v[N-1]); } + + inline void read (istream& is) { nr_container_read (is, *this); } inline void write (ostream& os) const { nr_container_write (os, *this); } inline void text_write (ostringstream& os) const { container_text_write (os, *this); } diff --git a/include/ustring.h b/include/ustring.h index f49db00..5f58608 100644 --- a/include/ustring.h +++ b/include/ustring.h @@ -64,7 +64,7 @@ public: inline string (const_pointer s, size_type len); inline string (const_pointer s1, const_pointer s2); string (size_type n, value_type c); - inline virtual ~string (void) noexcept { } + inline ~string (void) noexcept { } inline pointer data (void) { return (string::pointer (memblock::data())); } inline const_pointer data (void) const { return (string::const_pointer (memblock::data())); } inline const_pointer c_str (void) const { return (string::const_pointer (memblock::cdata())); } diff --git a/src/unew.cc b/src/unew.cc index e1389c2..72150da 100644 --- a/src/unew.cc +++ b/src/unew.cc @@ -8,5 +8,8 @@ void* tmalloc (size_t n) { void* p = malloc (n); - return (p); + if (!p) + return nullptr; // throw ustl::bad_alloc (n); + return p; } +