Created on 2004-05-12.00:00:00 last changed 172 months ago
Rationale:
Neither of these additions provides any new functionality but the LWG agreed that they are convenient, especially for novices. The exception type chosen for at, std::out_of_range, was chosen to match vector::at.
Proposed resolution:
In [vector], add the following to the vector synopsis after "element access" and before "modifiers":
// [lib.vector.data] data access pointer data(); const_pointer data() const;
Add a new subsection of [vector]:
23.2.4.x vector data access
pointer data(); const_pointer data() const;Returns: A pointer such that [data(), data() + size()) is a valid range. For a non-empty vector, data() == &front().
Complexity: Constant time.
Throws: Nothing.
In [map], add the following to the map synopsis immediately after the line for operator[]:
T& at(const key_type& x); const T& at(const key_type& x) const;
Add the following to [map.access]:
T& at(const key_type& x); const T& at(const key_type& x) const;Returns: A reference to the element whose key is equivalent to x, if such an element is present in the map.
Throws: out_of_range if no such element is present.
To add slightly more convenience to vector<T> and map<Key,T> we should consider to add
Rationale:
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2735 |
2010-10-21 18:28:33 | admin | set | messages: + msg2734 |
2004-05-12 00:00:00 | admin | create |