Function assign

Summary

#include <include/EASTL/string.h>

(1) this_type & assign(const this_type &x)

(2) this_type & assign(const this_type &x, size_type position, size_type n=npos)

(3) this_type & assign(const value_type *p, size_type n)

(4) this_type & assign(const value_type *p)

(5) this_type & assign(size_type n, value_type c)

(6) this_type & assign(const value_type *pBegin, const value_type *pEnd)

(7) this_type & assign(this_type &&x)

(8) this_type & assign(std::initializer_list< value_type >)

Function overload

Synopsis

#include <include/EASTL/string.h>

this_type & assign(const this_type &x)

Description

Assignment operations.

Source

Lines 1896-1901 in include/EASTL/string.h. Line 555 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(const this_type& x)
{
    // The C++11 Standard 21.4.6.3 p6 specifies that assign from this_type assigns contents only and not the allocator.
    return assign(x.internalLayout().BeginPtr(), x.internalLayout().EndPtr());
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(const this_type &x, size_type position, size_type n=npos)

Description

No description yet.

Source

Lines 1904-1916 in include/EASTL/string.h. Line 556 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(const this_type& x, size_type position, size_type n)
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY(position > x.internalLayout().GetSize()))
            ThrowRangeException();
    #endif
    // The C++11 Standard 21.4.6.3 p6 specifies that assign from this_type assigns contents only and not the allocator.
        return assign(
            x.internalLayout().BeginPtr() + position,
            x.internalLayout().BeginPtr() + position + eastl::min_alt(n, x.internalLayout().GetSize() - position));
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(const value_type *p, size_type n)

Description

No description yet.

Source

Lines 1919-1923 in include/EASTL/string.h. Line 557 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(const value_type* p, size_type n)
{
    return assign(p, p + n);
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(const value_type *p)

Description

No description yet.

Source

Lines 1926-1930 in include/EASTL/string.h. Line 558 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(const value_type* p)
{
    return assign(p, p + CharStrlen(p));
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(size_type n, value_type c)

Description

No description yet.

Source

Lines 1933-1947 in include/EASTL/string.h. Line 559 in include/EASTL/string.h.

template <typename T, typename Allocator>
basic_string<T, Allocator>& basic_string<T, Allocator>::assign(size_type n, value_type c)
{
    if(n <= internalLayout().GetSize())
    {
        CharTypeAssignN(internalLayout().BeginPtr(), n, c);
        erase(internalLayout().BeginPtr() + n, internalLayout().EndPtr());
    }
    else
    {
        CharTypeAssignN(internalLayout().BeginPtr(), internalLayout().GetSize(), c);
        append(n - internalLayout().GetSize(), c);
    }
    return *this;
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(const value_type *pBegin, const value_type *pEnd)

Description

No description yet.

Source

Lines 1950-1965 in include/EASTL/string.h. Line 560 in include/EASTL/string.h.

template <typename T, typename Allocator>
basic_string<T, Allocator>& basic_string<T, Allocator>::assign(const value_type* pBegin, const value_type* pEnd)
{
    const size_type n = (size_type)(pEnd - pBegin);
    if(n <= internalLayout().GetSize())
    {
        memmove(internalLayout().BeginPtr(), pBegin, (size_t)n * sizeof(value_type));
        erase(internalLayout().BeginPtr() + n, internalLayout().EndPtr());
    }
    else
    {
        memmove(internalLayout().BeginPtr(), pBegin, (size_t)(internalLayout().GetSize()) * sizeof(value_type));
        append(pBegin + internalLayout().GetSize(), pEnd);
    }
    return *this;
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(this_type &&x)

Description

No description yet.

Source

Lines 1975-1986 in include/EASTL/string.h. Line 561 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(this_type&& x)
{
    if(get_allocator() == x.get_allocator())
    {
        eastl::swap(internalLayout(), x.internalLayout());
    }
    else
        assign(x.internalLayout().BeginPtr(), x.internalLayout().EndPtr());
    return *this;
}

Synopsis

#include <include/EASTL/string.h>

this_type & assign(std::initializer_list< value_type >)

Description

No description yet.

Source

Lines 1968-1972 in include/EASTL/string.h. Line 562 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline basic_string<T, Allocator>& basic_string<T, Allocator>::assign(std::initializer_list<value_type> ilist)
{
    return assign(ilist.begin(), ilist.end());
}





Add Discussion as Guest

Log in