Browse Source

Changed get() to return a constant element.

release/0.19
JustinAJ 11 years ago
parent
commit
6452bd4350
  1. 4
      Jupiter/Readable_String.h
  2. 3
      Jupiter/String_Type.h
  3. 2
      Jupiter/String_Type_Imp.h

4
Jupiter/Readable_String.h

@ -46,7 +46,7 @@ namespace Jupiter
* @param index Index of the element to return. * @param index Index of the element to return.
* @return The element located at the specified index. * @return The element located at the specified index.
*/ */
virtual T &get(size_t index) const = 0; virtual const T &get(size_t index) const = 0;
/** /**
* @brief Returns the number of elements in the String. * @brief Returns the number of elements in the String.
@ -201,7 +201,7 @@ namespace Jupiter
template<template<typename> class R> static R<T> gotoWord(const T *in, size_t pos, const T *whitespace); template<template<typename> class R> static R<T> gotoWord(const T *in, size_t pos, const T *whitespace);
/** Access operator */ /** Access operator */
inline T &operator[](size_t index) const { return this->get(index); }; inline const T &operator[](size_t index) const { return this->get(index); };
/** Comparative operators */ /** Comparative operators */
inline bool operator==(const Readable_String<T> &right)const{ return this->equals(right); } inline bool operator==(const Readable_String<T> &right)const{ return this->equals(right); }

3
Jupiter/String_Type.h

@ -46,7 +46,8 @@ namespace Jupiter
* @param index Index of the element to return. * @param index Index of the element to return.
* @return The element located at the specified index. * @return The element located at the specified index.
*/ */
T &get(size_t index) const; const T &get(size_t index) const;
//T &get(size_t index) const;
/** /**
* @brief Returns the number of elements in the String. * @brief Returns the number of elements in the String.

2
Jupiter/String_Type_Imp.h

@ -40,7 +40,7 @@ template<typename T> Jupiter::String_Type<T>::String_Type(Jupiter::String_Type<T
source.str = nullptr; source.str = nullptr;
} }
template<typename T> T &Jupiter::String_Type<T>::get(size_t index) const template<typename T> const T &Jupiter::String_Type<T>::get(size_t index) const
{ {
return Jupiter::String_Type<T>::str[index]; return Jupiter::String_Type<T>::str[index];
} }

Loading…
Cancel
Save