Function left

Synopsis

#include <include/EASTL/string.h>

this_type left(size_type n) const

Description

No description yet.

Source

Lines 3105-3114 in include/EASTL/string.h. Line 743 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator> basic_string<T, Allocator>::left(size_type n) const
{
    const size_type nLength = length();
    if(n < nLength)
        return substr(0, n);
    // C++ std says that substr must return default constructed allocated, but we do not.
    // Instead it is much more practical to provide the copy of the current allocator
    return basic_string(*this, get_allocator());
}





Add Discussion as Guest

Log in