name: don't dereference past-the-end iterator

refs #4181

Change-Id: Ic3b430e264d0dce017e3514c6501ac18117f7868
diff --git a/src/name.hpp b/src/name.hpp
index 764bdac..890451f 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -221,8 +221,7 @@
   const_iterator
   begin() const
   {
-    // XXX This triggers undefined behavior if name is empty (#4181)
-    return reinterpret_cast<const_iterator>(&*m_wire.elements().begin());
+    return reinterpret_cast<const_iterator>(m_wire.elements().data());
   }
 
   /** @brief End iterator
@@ -230,8 +229,7 @@
   const_iterator
   end() const
   {
-    // XXX This triggers undefined behavior if name is empty (#4181)
-    return reinterpret_cast<const_iterator>(&*m_wire.elements().end());
+    return reinterpret_cast<const_iterator>(m_wire.elements().data() + m_wire.elements().size());
   }
 
   /** @brief Reverse begin iterator