Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,38 @@ struct _Cl_names { // structure to associate class name with mask value
}
};

template <class _Traits>
struct _Char_traits_eq {
using _Elem = typename _Traits::char_type;

bool operator()(_Elem _Left, _Elem _Right) const noexcept {
return _Traits::eq(_Left, _Right);
}
};

template <class _Traits>
struct _Char_traits_lt {
using _Elem = typename _Traits::char_type;

bool operator()(_Elem _Left, _Elem _Right) const noexcept {
return _Traits::lt(_Left, _Right);
}
};

// library-provided char_traits::eq behaves like equal_to<_Elem>
// TRANSITION: This should not be activated for user-defined specializations of char_traits
template <class _Elem>
_INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred<_Elem, _Elem, _Char_traits_eq<char_traits<_Elem>>> =
_Can_memcmp_elements<_Elem, _Elem>;

// library-provided char_traits::lt behaves like less<make_unsigned_t<_Elem>>
// TRANSITION: This should not be activated for user-defined specializations of char_traits
template <class _Elem>
struct _Lex_compare_memcmp_classify_pred<_Elem, _Elem, _Char_traits_lt<char_traits<_Elem>>> {
using _UElem = make_unsigned_t<_Elem>;
using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_UElem, _UElem>, less<int>, void>;
};

template <class _RxTraits>
struct _Cmp_cs { // functor to compare two character values for equality
using _Elem = typename _RxTraits::char_type;
Expand Down
32 changes: 0 additions & 32 deletions stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -535,38 +535,6 @@ basic_ostream<_Elem, _Traits>& _Insert_string(
return _Ostr;
}

template <class _Traits>
struct _Char_traits_eq {
using _Elem = typename _Traits::char_type;

bool operator()(_Elem _Left, _Elem _Right) const noexcept {
return _Traits::eq(_Left, _Right);
}
};

template <class _Traits>
struct _Char_traits_lt {
using _Elem = typename _Traits::char_type;

bool operator()(_Elem _Left, _Elem _Right) const noexcept {
return _Traits::lt(_Left, _Right);
}
};

// library-provided char_traits::eq behaves like equal_to<_Elem>
// TRANSITION: This should not be activated for user-defined specializations of char_traits
template <class _Elem>
_INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred<_Elem, _Elem, _Char_traits_eq<char_traits<_Elem>>> =
_Can_memcmp_elements<_Elem, _Elem>;

// library-provided char_traits::lt behaves like less<make_unsigned_t<_Elem>>
// TRANSITION: This should not be activated for user-defined specializations of char_traits
template <class _Elem>
struct _Lex_compare_memcmp_classify_pred<_Elem, _Elem, _Char_traits_lt<char_traits<_Elem>>> {
using _UElem = make_unsigned_t<_Elem>;
using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_UElem, _UElem>, less<int>, void>;
};

template <class _Traits>
using _Traits_ch_t = typename _Traits::char_type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <functional>
#include <iterator>
#include <list>
#include <regex>
#include <string>
#include <type_traits>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <functional>
#include <iterator>
#include <list>
#include <regex>
#include <string>
#include <type_traits>
#include <vector>
Expand Down