diff options
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/bits/iterator_concepts.h | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/std/format | 28 |
2 files changed, 18 insertions, 15 deletions
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h index e36556d..3b73ff9 100644 --- a/libstdc++-v3/include/bits/iterator_concepts.h +++ b/libstdc++-v3/include/bits/iterator_concepts.h @@ -829,11 +829,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using __projected_Proj = _Proj; }; }; - - // Optimize the common case of the projection being std::identity. - template<typename _Iter> - struct __projected<_Iter, identity> - { using __type = _Iter; }; } // namespace __detail /// [projected], projected diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 27253f5..e557e10 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -555,8 +555,8 @@ namespace __format constexpr iterator _M_parse_fill_and_align(iterator __first, iterator __last, string_view __not_fill) noexcept { - for (char c : __not_fill) - if (*__first == c) + for (char __c : __not_fill) + if (*__first == static_cast<_CharT>(__c)) return __first; using namespace __unicode; @@ -5160,7 +5160,10 @@ namespace __format /// @cond undocumented template<typename _Rg> - constexpr auto format_kind = not defined(format_kind<_Rg>); + constexpr auto format_kind = + __primary_template_not_defined( + format_kind<_Rg> // you can specialize this for non-const input ranges + ); template<typename _Tp> consteval range_format @@ -5252,6 +5255,14 @@ namespace __format = ranges::input_range<const _Rg> && formattable<ranges::range_reference_t<const _Rg>, _CharT>; + // _Rg& and const _Rg& are both formattable and use same formatter + // specialization for their references. + template<typename _Rg, typename _CharT> + concept __simply_formattable_range + = __const_formattable_range<_Rg, _CharT> + && same_as<remove_cvref_t<ranges::range_reference_t<_Rg>>, + remove_cvref_t<ranges::range_reference_t<const _Rg>>>; + template<typename _Rg, typename _CharT> using __maybe_const_range = __conditional_t<__const_formattable_range<_Rg, _CharT>, const _Rg, _Rg>; @@ -5635,13 +5646,10 @@ namespace __format format(_Rg&& __rg, basic_format_context<_Out, _CharT>& __fc) const { using _Range = remove_reference_t<_Rg>; - if constexpr (__format::__const_formattable_range<_Range, _CharT>) - { - using _CRef = ranges::range_reference_t<const _Range>; - if constexpr (same_as<remove_cvref_t<_CRef>, _Tp>) - return _M_format<const _Range>(__rg, __fc); - } - return _M_format(__rg, __fc); + if constexpr (__format::__simply_formattable_range<_Range, _CharT>) + return _M_format<const _Range>(__rg, __fc); + else + return _M_format(__rg, __fc); } private: |