diff options
| author | Michael Bebenita <[email protected]> | 2010-08-09 06:59:46 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-08-09 06:59:46 -0700 |
| commit | 76ba8f1d84cf9e8f91233184d1b7c7192775143d (patch) | |
| tree | 6d2bedb8a580f0965e921fcb148eb8f6e49f0208 /src/rt/util/array_list.h | |
| parent | Added Eclipse's .project and .cproject to .gitignore. (diff) | |
| download | rust-76ba8f1d84cf9e8f91233184d1b7c7192775143d.tar.xz rust-76ba8f1d84cf9e8f91233184d1b7c7192775143d.zip | |
Changed array_list::replace() return behavior.
Diffstat (limited to 'src/rt/util/array_list.h')
| -rw-r--r-- | src/rt/util/array_list.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rt/util/array_list.h b/src/rt/util/array_list.h index e6ce55ab..929117f3 100644 --- a/src/rt/util/array_list.h +++ b/src/rt/util/array_list.h @@ -16,7 +16,7 @@ public: int32_t append(T value); int32_t push(T value); T pop(); - T replace(T old_value, T new_value); + bool replace(T old_value, T new_value); int32_t index_of(T value); bool is_empty(); T & operator[](size_t index); @@ -62,16 +62,16 @@ array_list<T>::pop() { /** * Replaces the old_value in the list with the new_value. - * Returns the old_value if the replacement succeeded, or NULL otherwise. + * Returns the true if the replacement succeeded, or false otherwise. */ -template<typename T> T +template<typename T> bool array_list<T>::replace(T old_value, T new_value) { int index = index_of(old_value); if (index < 0) { - return NULL; + return false; } _data[index] = new_value; - return old_value; + return true; } template<typename T> int32_t |