Index: include/__bit_reference =================================================================== --- include/__bit_reference +++ include/__bit_reference @@ -303,13 +303,33 @@ } template +struct __count_helper +{ + typename __bit_iterator<_Cp, _IsConst>::difference_type + static inline _LIBCPP_INLINE_VISIBILITY + __count(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) + { + return __count_bool_false(__first, __n); + } +}; + +template +struct __count_helper<_Cp, _IsConst, bool> +{ + typename __bit_iterator<_Cp, _IsConst>::difference_type + static inline _LIBCPP_INLINE_VISIBILITY + __count(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) + { + return __count_bool_true(__first, __n); + } +}; + +template inline _LIBCPP_INLINE_VISIBILITY typename __bit_iterator<_Cp, _IsConst>::difference_type -count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) +count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp&) { - if (static_cast(__value_)) - return __count_bool_true(__first, static_cast(__last - __first)); - return __count_bool_false(__first, static_cast(__last - __first)); + return __count_helper<_Cp, _IsConst, _Tp>::__count(__first, static_cast(__last - __first)); } // fill_n