Function operator[]

Summary

#include <include/EASTL/string.h>

(1) reference operator[](size_type n)

(2) const_reference operator[](size_type n) const

Function overload

Synopsis

#include <include/EASTL/string.h>

reference operator[](size_type n)

Description

Element access.

Source

Lines 1205-1215 in include/EASTL/string.h. Line 610 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline typename basic_string<T, Allocator>::reference
basic_string<T, Allocator>::operator[](size_type n)
{
    #if EASTL_ASSERT_ENABLED // We allow the user to reference the trailing 0 char without asserting. Perhaps we shouldn't.
        if(EASTL_UNLIKELY(n > internalLayout().GetSize()))
            EASTL_FAIL_MSG("basic_string::operator[] -- out of range");
    #endif
    return internalLayout().BeginPtr()[n]; // Sometimes done as *(mpBegin + n)
}

Synopsis

#include <include/EASTL/string.h>

const_reference operator[](size_type n) const

Description

No description yet.

Source

Lines 1192-1202 in include/EASTL/string.h. Line 611 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline typename basic_string<T, Allocator>::const_reference
basic_string<T, Allocator>::operator[](size_type n) const
{
    #if EASTL_ASSERT_ENABLED // We allow the user to reference the trailing 0 char without asserting. Perhaps we shouldn't.
        if(EASTL_UNLIKELY(n > internalLayout().GetSize()))
            EASTL_FAIL_MSG("basic_string::operator[] -- out of range");
    #endif
    return internalLayout().BeginPtr()[n]; // Sometimes done as *(mpBegin + n)
}





Add Discussion as Guest

Log in