@@ -4047,6 +4047,91 @@ _CONSTEXPR20 _OutIt _Transform_vbool_aligned(
40474047 return _Dest;
40484048}
40494049
4050+ struct _All_of_vbool_traits {
4051+ static constexpr bool _Default_result = true;
4052+
4053+ static _CONSTEXPR20 bool _Check(const _Vbase _Value) {
4054+ return _Value != ~_Vbase{0};
4055+ }
4056+
4057+ static _CONSTEXPR20 bool _Check(const _Vbase _Value, const _Vbase _Mask) {
4058+ return (_Value & _Mask) != _Mask;
4059+ }
4060+ };
4061+
4062+ struct _Any_of_vbool_traits_base {
4063+ static _CONSTEXPR20 bool _Check(const _Vbase _Value) {
4064+ return _Value != 0;
4065+ }
4066+
4067+ static _CONSTEXPR20 bool _Check(const _Vbase _Value, const _Vbase _Mask) {
4068+ return (_Value & _Mask) != 0;
4069+ }
4070+ };
4071+
4072+ struct _Any_of_vbool_traits : _Any_of_vbool_traits_base {
4073+ static constexpr bool _Default_result = false;
4074+ };
4075+
4076+ struct _None_of_vbool_traits : _Any_of_vbool_traits_base {
4077+ static constexpr bool _Default_result = true;
4078+ };
4079+
4080+ template <class _Traits, class _VbIt, class _Mapped_fn>
4081+ _NODISCARD _CONSTEXPR20 bool _Meow_of_vbool(const _VbIt _First, const _VbIt _Last, const _Mapped_fn _Mapped_func) {
4082+ constexpr bool _Early_result = !_Traits::_Default_result;
4083+ auto _First_ptr = _First._Myptr;
4084+ const auto _Last_ptr = _Last._Myptr;
4085+
4086+ if (_First_ptr == _Last_ptr) {
4087+ const _Vbase _Mask = (_Vbase{1} << _Last._Myoff) - (_Vbase{1} << _First._Myoff);
4088+ if (_Mask == 0) {
4089+ return _Traits::_Default_result;
4090+ } else {
4091+ return _Traits::_Check(_Mapped_func(*_First_ptr), _Mask) ? _Early_result : _Traits::_Default_result;
4092+ }
4093+ }
4094+
4095+ if (_First._Myoff != 0) {
4096+ const _Vbase _Mask = static_cast<_Vbase>(-1) << _First._Myoff;
4097+ if (_Traits::_Check(_Mapped_func(*_First_ptr), _Mask)) {
4098+ return _Early_result;
4099+ }
4100+
4101+ ++_First_ptr;
4102+ }
4103+
4104+ for (; _First_ptr != _Last_ptr; ++_First_ptr) {
4105+ if (_Traits::_Check(_Mapped_func(*_First_ptr))) {
4106+ return _Early_result;
4107+ }
4108+ }
4109+
4110+ if (_Last._Myoff != 0) {
4111+ const _Vbase _Mask = (_Vbase{1} << _Last._Myoff) - 1;
4112+ if (_Traits::_Check(_Mapped_func(*_First_ptr), _Mask)) {
4113+ return _Early_result;
4114+ }
4115+ }
4116+
4117+ return _Traits::_Default_result;
4118+ }
4119+
4120+ template <class _VbIt, class _Mapped_fn>
4121+ _NODISCARD _CONSTEXPR20 bool _All_of_vbool(const _VbIt _First, const _VbIt _Last, const _Mapped_fn _Mapped_func) {
4122+ return _Meow_of_vbool<_All_of_vbool_traits>(_First, _Last, _Mapped_func);
4123+ }
4124+
4125+ template <class _VbIt, class _Mapped_fn>
4126+ _NODISCARD _CONSTEXPR20 bool _Any_of_vbool(const _VbIt _First, const _VbIt _Last, const _Mapped_fn _Mapped_func) {
4127+ return _Meow_of_vbool<_Any_of_vbool_traits>(_First, _Last, _Mapped_func);
4128+ }
4129+
4130+ template <class _VbIt, class _Mapped_fn>
4131+ _NODISCARD _CONSTEXPR20 bool _None_of_vbool(const _VbIt _First, const _VbIt _Last, const _Mapped_fn _Mapped_func) {
4132+ return _Meow_of_vbool<_None_of_vbool_traits>(_First, _Last, _Mapped_func);
4133+ }
4134+
40504135#undef _ASAN_VECTOR_MODIFY
40514136#undef _ASAN_VECTOR_REMOVE
40524137#undef _ASAN_VECTOR_CREATE
0 commit comments