8#ifndef INCLUDED_BSLALG_RANGECOMPARE
9#define INCLUDED_BSLALG_RANGECOMPARE
359#include <bslscm_version.h>
417 template <
class INPUT_ITER>
418 static bool equal(INPUT_ITER start1,
438 template <
class INPUT_ITER>
439 static bool equal(INPUT_ITER start1,
443 template <
class INPUT_ITER>
444 static bool equal(INPUT_ITER start1, INPUT_ITER end1,
size_type length1,
445 INPUT_ITER start2, INPUT_ITER end2,
size_type length2);
463 template <
class INPUT_ITER>
468 template <
class INPUT_ITER>
497 template <
class VALUE_TYPE>
498 static bool equal(
const VALUE_TYPE *start1,
499 const VALUE_TYPE *end1,
500 const VALUE_TYPE *start2,
501 const VALUE_TYPE *end2,
504 template <
class INPUT_ITER,
class VALUE_TYPE>
505 static bool equal(INPUT_ITER start1,
511 template <
class INPUT_ITER,
class VALUE_TYPE>
512 static bool equal(INPUT_ITER start1,
525 template <
class INPUT_ITER,
class VALUE_TYPE>
526 static bool equal(INPUT_ITER start1,
531 template <
class INPUT_ITER,
class VALUE_TYPE>
532 static bool equal(INPUT_ITER start1,
537 template <
class INPUT_ITER,
class VALUE_TYPE>
538 static bool equal(INPUT_ITER start1,
550 template <
class VALUE_TYPE>
552 const VALUE_TYPE *end1,
553 const VALUE_TYPE *start2,
564 template <
class INPUT_ITER>
580 template <
class VALUE_TYPE>
582 const VALUE_TYPE *end1,
583 const VALUE_TYPE *start2,
584 const VALUE_TYPE *end2,
598 template <
class INPUT_ITER,
class VALUE_TYPE>
617 template <
class INPUT_ITER,
class VALUE_TYPE>
639 const unsigned char *end1,
640 const unsigned char *start2);
651 const wchar_t *start2);
652 template <
class INPUT_ITER>
657 template <
class INPUT_ITER>
672template <
class INPUT_ITER>
678 if (start1 == end1) {
684template <
class INPUT_ITER>
691 if (start1 == end1) {
692 return start2 == end2;
697template <
class INPUT_ITER>
706 if (length1 != length2) {
709 if (start1 == end1) {
715template <
class INPUT_ITER>
721 if (start1 == end1) {
722 return start2 != end2 ? -1 : 0;
731template <
class INPUT_ITER>
739 const int result = length2 < length1
753 if (length1 < length2) {
756 if (length2 < length1) {
770template <
class VALUE_TYPE>
773 const VALUE_TYPE *end1,
774 const VALUE_TYPE *start2,
775 const VALUE_TYPE *end2,
787template <
class INPUT_ITER,
class VALUE_TYPE>
795 for ( ; start1 != end1 && start2 != end2; ++start1, ++start2) {
796 if (!(*start1 == *start2)) {
800 return start1 == end1 && start2 == end2;
803template <
class INPUT_ITER,
class VALUE_TYPE>
808 const VALUE_TYPE& value)
811 CanUseLengthOptimization;
818 CanUseLengthOptimization());
821template <
class INPUT_ITER,
class VALUE_TYPE>
836 CanUseBitwiseCompareOptimization;
841 CanUseBitwiseCompareOptimization());
844template <
class INPUT_ITER,
class VALUE_TYPE>
851 for ( ; start1 != end1; ++start1, ++start2) {
852 if (!(*start1 == *start2)) {
859template <
class INPUT_ITER,
class VALUE_TYPE>
864 const VALUE_TYPE& value)
868 return equal(start1, end1, start2, value, Trait());
873template <
class VALUE_TYPE>
876 const VALUE_TYPE *start1,
877 const VALUE_TYPE *end1,
878 const VALUE_TYPE *start2,
881 std::size_t numBytes =
reinterpret_cast<const char *
>(end1)
882 -
reinterpret_cast<const char *
>(start1);
884 return 0 == std::memcmp(
reinterpret_cast<const void *
>(start1),
885 reinterpret_cast<const void *
>(start2),
889template <
class INPUT_ITER>
903template <
class VALUE_TYPE>
906 const VALUE_TYPE *end1,
907 const VALUE_TYPE *start2,
908 const VALUE_TYPE *end2,
923template <
class INPUT_ITER,
class VALUE_TYPE>
931 for ( ; start1 != end1 && start2 != end2; ++start1, ++start2) {
932 if (*start1 < *start2) {
935 else if (*start2 < *start1) {
939 if (start1 != end1) {
942 if (start2 != end2) {
948template <
class INPUT_ITER,
class VALUE_TYPE>
954 const VALUE_TYPE& value)
957 CanUseLengthOptimization;
960 CanUseLengthOptimization());
965 const unsigned char *end1,
966 const unsigned char *start2)
968 return std::memcmp(start1, start2, end1 - start1);
976#if CHAR_MAX == SCHAR_MAX
977 return std::memcmp(start1, start2, (end1 - start1));
979 return lexicographical<const char *>(start1, end1, start2, 0);
986 const wchar_t *start2)
988 return std::wmemcmp(start1, start2, end1 - start1);
991template <
class INPUT_ITER>
997 for ( ; start1 != end1; ++start1, ++start2) {
998 if (*start1 < *start2) {
1001 else if (*start2 < *start1) {
1008template <
class INPUT_ITER>
1014 if (start1 != end1) {
1022#ifndef BDE_OPENSOURCE_PUBLICATION
bslalg::RangeCompare bslalg_RangeCompare
This alias is defined for backward compatibility.
Definition bslalg_rangecompare.h:1028
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlc_flathashmap.h:1805
Definition bslmf_isconvertible.h:867
Definition bslalg_rangecompare.h:486
static int lexicographical(const VALUE_TYPE *start1, const VALUE_TYPE *end1, const VALUE_TYPE *start2, const VALUE_TYPE *end2, const VALUE_TYPE &, bsl::true_type)
Definition bslalg_rangecompare.h:905
static bool equal(const VALUE_TYPE *start1, const VALUE_TYPE *end1, const VALUE_TYPE *start2, const VALUE_TYPE *end2, const VALUE_TYPE &, bsl::true_type)
Definition bslalg_rangecompare.h:772
static bool equalBitwiseEqualityComparable(const VALUE_TYPE *start1, const VALUE_TYPE *end1, const VALUE_TYPE *start2, bsl::true_type)
Definition bslalg_rangecompare.h:875
Definition bslalg_rangecompare.h:398
static bool equal(INPUT_ITER start1, INPUT_ITER end1, INPUT_ITER start2)
Definition bslalg_rangecompare.h:674
std::size_t size_type
Definition bslalg_rangecompare.h:404
static int lexicographical(INPUT_ITER start1, INPUT_ITER end1, INPUT_ITER start2, INPUT_ITER end2)
Definition bslalg_rangecompare.h:716
Definition bslmf_isbitwiseequalitycomparable.h:499
Any type can be converted into this type.
Definition bslmf_matchanytype.h:150