Function compare

Summary

#include <include/EASTL/string.h>

(1) int compare(const this_type &x) const EA_NOEXCEPT

(2) int compare(size_type pos1, size_type n1, const this_type &x) const

(3) int compare(size_type pos1, size_type n1, const this_type &x, size_type pos2, size_type n2) const

(4) int compare(const value_type *p) const

(5) int compare(size_type pos1, size_type n1, const value_type *p) const

(6) int compare(size_type pos1, size_type n1, const value_type *p, size_type n2) const

(7) static int compare(const value_type *pBegin1, const value_type *pEnd1, const value_type *pBegin2, const value_type *pEnd2)

Function overload

Synopsis

#include <include/EASTL/string.h>

int compare(const this_type &x) const EA_NOEXCEPT

Description

Comparison operations.

Source

Lines 2962-2966 in include/EASTL/string.h. Line 721 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(const this_type& x) const EA_NOEXCEPT
{
    return compare(internalLayout().BeginPtr(), internalLayout().EndPtr(), x.internalLayout().BeginPtr(), x.internalLayout().EndPtr());
}

Synopsis

#include <include/EASTL/string.h>

int compare(size_type pos1, size_type n1, const this_type &x) const

Description

No description yet.

Source

Lines 2969-2981 in include/EASTL/string.h. Line 722 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(size_type pos1, size_type n1, const this_type& x) const
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY(pos1 > internalLayout().GetSize()))
            ThrowRangeException();
    #endif
    return compare(
        internalLayout().BeginPtr() + pos1,
        internalLayout().BeginPtr() + pos1 + eastl::min_alt(n1, internalLayout().GetSize() - pos1),
        x.internalLayout().BeginPtr(), x.internalLayout().EndPtr());
}

Synopsis

#include <include/EASTL/string.h>

int compare(size_type pos1, size_type n1, const this_type &x, size_type pos2, size_type n2) const

Description

No description yet.

Source

Lines 2984-2997 in include/EASTL/string.h. Line 723 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(size_type pos1, size_type n1, const this_type& x, size_type pos2, size_type n2) const
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY((pos1 > (size_type)(internalLayout().EndPtr() - internalLayout().BeginPtr())) ||
                          (pos2 > (size_type)(x.internalLayout().EndPtr() - x.internalLayout().BeginPtr()))))
            ThrowRangeException();
    #endif
    return compare(internalLayout().BeginPtr() + pos1,
                   internalLayout().BeginPtr() + pos1 + eastl::min_alt(n1, internalLayout().GetSize() - pos1),
                   x.internalLayout().BeginPtr() + pos2,
                   x.internalLayout().BeginPtr() + pos2 + eastl::min_alt(n2, x.internalLayout().GetSize() - pos2));
}

Synopsis

#include <include/EASTL/string.h>

int compare(const value_type *p) const

Description

No description yet.

Source

Lines 3000-3004 in include/EASTL/string.h. Line 724 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(const value_type* p) const
{
    return compare(internalLayout().BeginPtr(), internalLayout().EndPtr(), p, p + CharStrlen(p));
}

Synopsis

#include <include/EASTL/string.h>

int compare(size_type pos1, size_type n1, const value_type *p) const

Description

No description yet.

Source

Lines 3007-3019 in include/EASTL/string.h. Line 725 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(size_type pos1, size_type n1, const value_type* p) const
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY(pos1 > internalLayout().GetSize()))
            ThrowRangeException();
    #endif
    return compare(internalLayout().BeginPtr() + pos1,
                   internalLayout().BeginPtr() + pos1 + eastl::min_alt(n1, internalLayout().GetSize() - pos1),
                   p,
                   p + CharStrlen(p));
}

Synopsis

#include <include/EASTL/string.h>

int compare(size_type pos1, size_type n1, const value_type *p, size_type n2) const

Description

No description yet.

Source

Lines 3022-3034 in include/EASTL/string.h. Line 726 in include/EASTL/string.h.

template <typename T, typename Allocator>
inline int basic_string<T, Allocator>::compare(size_type pos1, size_type n1, const value_type* p, size_type n2) const
{
    #if EASTL_STRING_OPT_RANGE_ERRORS
        if(EASTL_UNLIKELY(pos1 > internalLayout().GetSize()))
            ThrowRangeException();
    #endif
    return compare(internalLayout().BeginPtr() + pos1,
                   internalLayout().BeginPtr() + pos1 + eastl::min_alt(n1, internalLayout().GetSize() - pos1),
                   p,
                   p + n2);
}

Synopsis

#include <include/EASTL/string.h>

static int compare(const value_type *pBegin1, const value_type *pEnd1, const value_type *pBegin2, const value_type *pEnd2)

Description

No description yet.

Source

Lines 3151-3161 in include/EASTL/string.h. Line 727 in include/EASTL/string.h.

template <typename T, typename Allocator>
int basic_string<T, Allocator>::compare(const value_type* pBegin1, const value_type* pEnd1,
                                        const value_type* pBegin2, const value_type* pEnd2)
{
    const difference_type n1   = pEnd1 - pBegin1;
    const difference_type n2   = pEnd2 - pBegin2;
    const difference_type nMin = eastl::min_alt(n1, n2);
    const int       cmp  = Compare(pBegin1, pBegin2, (size_t)nMin);
    return (cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0)));
}





Add Discussion as Guest

Log in