@@ -87,9 +87,32 @@ class indexed_vector {
8787 \brief Returns a pointer to the element at the given numeric index,
8888 or nullptr if no element exists at the given index.
8989 */
90- virtual inline T* at (size_t id) const {
90+ virtual inline const T* at (size_t id) const {
9191 if (id < m_entries.size ()) {
92- return (T* const )&m_entries[id];
92+ return &m_entries[id];
93+ }
94+ return nullptr ;
95+ }
96+
97+ /* !
98+ \brief Returns a pointer to the element at the given numeric index,
99+ or nullptr if no element exists at the given index.
100+ */
101+ virtual inline T* at (size_t id) {
102+ if (id < m_entries.size ()) {
103+ return &m_entries[id];
104+ }
105+ return nullptr ;
106+ }
107+
108+ /* !
109+ \brief Returns a pointer to the element at the given string index,
110+ or nullptr if no element exists at the given index.
111+ */
112+ virtual inline const T* at (const std::string& index) const {
113+ auto it = m_index.find (index);
114+ if (it != m_index.end ()) {
115+ return at (it->second );
93116 }
94117 return nullptr ;
95118 }
@@ -98,7 +121,7 @@ class indexed_vector {
98121 \brief Returns a pointer to the element at the given string index,
99122 or nullptr if no element exists at the given index.
100123 */
101- virtual inline T* at (const std::string& index) const {
124+ virtual inline T* at (const std::string& index) {
102125 auto it = m_index.find (index);
103126 if (it != m_index.end ()) {
104127 return at (it->second );
0 commit comments