From 74a6fdea77d52a17be4bc38831fe02a31cefbf34 Mon Sep 17 00:00:00 2001 From: Nicolas Catania Date: Thu, 28 Jan 2010 16:48:34 -0800 Subject: Added the 'at' method to string. --- include/string | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/string b/include/string index 8e1ebbe..7c2f474 100644 --- a/include/string +++ b/include/string @@ -193,6 +193,10 @@ class string // @return a reference to the char. char& operator[](const size_type pos); + // 'at' is similar to operator[] except that it does check bounds. + const char& at(const size_type pos) const; + char& at(const size_type pos); + // Assignments. string& operator=(const string& str) { return assign(str); } string& operator=(const char* str) { return assign(str); } -- cgit v1.2.3