Skip to content

Commit a2979f3

Browse files
Remove unnecessary typenames for <format> (#3892)
Co-authored-by: Casey Carter <[email protected]>
1 parent db80afc commit a2979f3

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

stl/inc/filesystem

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ namespace filesystem {
345345
}
346346
}
347347

348+
struct _Is_slash_oper { // predicate testing if input is a preferred-separator or fallback-separator
349+
_NODISCARD constexpr bool operator()(const wchar_t _Ch) const {
350+
return _Ch == L'\\' || _Ch == L'/';
351+
}
352+
};
353+
354+
inline constexpr _Is_slash_oper _Is_slash{};
355+
348356
template <class _Ty>
349357
_NODISCARD _Ty _Unaligned_load(const void* _Ptr) { // load a _Ty from _Ptr
350358
static_assert(is_trivial_v<_Ty>, "Unaligned loads require trivial types");

stl/inc/format

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ _EXPORT_STD template <class _CharT>
574574
class basic_format_parse_context {
575575
public:
576576
using char_type = _CharT;
577-
using const_iterator = typename basic_string_view<_CharT>::const_iterator;
577+
using const_iterator = basic_string_view<_CharT>::const_iterator;
578578
using iterator = const_iterator;
579579

580580
constexpr explicit basic_format_parse_context(
@@ -648,7 +648,7 @@ private:
648648
_EXPORT_STD using format_parse_context = basic_format_parse_context<char>;
649649
_EXPORT_STD using wformat_parse_context = basic_format_parse_context<wchar_t>;
650650

651-
template <class _Ty, class _Context, class _Formatter = typename _Context::template formatter_type<remove_const_t<_Ty>>>
651+
template <class _Ty, class _Context, class _Formatter = _Context::template formatter_type<remove_const_t<_Ty>>>
652652
concept _Formattable_with = semiregular<_Formatter>
653653
&& requires(_Formatter& __f, const _Formatter& __cf, _Ty&& __t, _Context __fc,
654654
basic_format_parse_context<typename _Context::char_type> __pc) {
@@ -667,7 +667,7 @@ inline constexpr bool _Is_basic_string_like_for<basic_string_view<_CharT, _Trait
667667

668668
template <class _Context>
669669
struct _Format_arg_traits {
670-
using _Char_type = typename _Context::char_type;
670+
using _Char_type = _Context::char_type;
671671

672672
// Function template _Type_eraser mirrors the type dispatching mechanism in the construction of basic_format_arg
673673
// (N4950 [format.arg]). They determine the mapping from "raw" to "erased" argument type for _Format_arg_store.
@@ -692,7 +692,7 @@ _FMT_P2286_END
692692
_EXPORT_STD template <class _Context>
693693
class basic_format_arg {
694694
public:
695-
using _CharType = typename _Context::char_type;
695+
using _CharType = _Context::char_type;
696696

697697
class handle {
698698
private:
@@ -734,7 +734,7 @@ public:
734734
// basic_format_arg (N4950 [format.arg]).
735735
template <_Formattable_with<_Context> _Ty>
736736
static basic_format_arg _Make_from(_Ty& _Val) noexcept {
737-
using _Erased_type = typename _Format_arg_traits<_Context>::template _Storage_type<_Ty>;
737+
using _Erased_type = _Format_arg_traits<_Context>::template _Storage_type<_Ty>;
738738
#if !_HAS_CXX23
739739
if constexpr (is_same_v<_Erased_type, basic_string_view<_CharType>>) {
740740
return basic_format_arg(_Erased_type{_Val.data(), _Val.size()});
@@ -1639,7 +1639,7 @@ _NODISCARD constexpr int _Get_dynamic_specs(const _FormatArg _Arg) {
16391639
template <class _ParseContext, class _Context>
16401640
class _Specs_handler : public _Specs_setter<typename _Context::char_type> {
16411641
public:
1642-
using _CharT = typename _Context::char_type;
1642+
using _CharT = _Context::char_type;
16431643

16441644
constexpr _Specs_handler(_Basic_format_specs<_CharT>& _Specs_, _ParseContext& _Parse_ctx_, _Context& _Ctx_)
16451645
: _Specs_setter<_CharT>(_Specs_), _Parse_ctx(_Parse_ctx_), _Ctx(_Ctx_) {}
@@ -1671,7 +1671,7 @@ private:
16711671
template <class _ParseContext>
16721672
class _Dynamic_specs_handler : public _Specs_setter<typename _ParseContext::char_type> {
16731673
public:
1674-
using _CharT = typename _ParseContext::char_type;
1674+
using _CharT = _ParseContext::char_type;
16751675

16761676
constexpr _Dynamic_specs_handler(_Dynamic_format_specs<_CharT>& _Specs_, _ParseContext& _Parse_ctx_)
16771677
: _Specs_setter<_CharT>(_Specs_), _Dynamic_specs(_Specs_), _Parse_ctx(_Parse_ctx_) {}
@@ -1942,7 +1942,7 @@ struct _Format_arg_index {
19421942
template <class _Context, class... _Args>
19431943
class _Format_arg_store {
19441944
private:
1945-
using _CharType = typename _Context::char_type;
1945+
using _CharType = _Context::char_type;
19461946
using _Traits = _Format_arg_traits<_Context>;
19471947

19481948
friend basic_format_args<_Context>;
@@ -1977,7 +1977,7 @@ private:
19771977

19781978
template <class _Ty>
19791979
void _Store(const size_t _Arg_index, _Ty&& _Val) noexcept {
1980-
using _Erased_type = typename _Traits::template _Storage_type<_Ty>;
1980+
using _Erased_type = _Traits::template _Storage_type<_Ty>;
19811981

19821982
_Basic_format_arg_type _Arg_type;
19831983
if constexpr (is_same_v<_Erased_type, bool>) {
@@ -2047,7 +2047,7 @@ public:
20472047
return basic_format_arg<_Context>{};
20482048
}
20492049

2050-
using _CharType = typename _Context::char_type;
2050+
using _CharType = _Context::char_type;
20512051
// The explanatory comment in _Format_arg_store explains how the following works.
20522052
const auto _Packed_index = _Index_array[_Index];
20532053
const auto _Arg_storage =
@@ -2089,7 +2089,7 @@ public:
20892089
}
20902090

20912091
_NODISCARD size_t _Estimate_required_capacity() const noexcept {
2092-
using _CharType = typename _Context::char_type;
2092+
using _CharType = _Context::char_type;
20932093
size_t _Result = 0;
20942094

20952095
for (size_t _Idx = 0; _Idx < _Num_args; ++_Idx) {
@@ -2320,7 +2320,7 @@ private:
23202320
const auto _End = _Data + this->_Limit(_Size);
23212321

23222322
// extracts back_insert_iterator's underlying container type, or void if not.
2323-
using _Container = typename _Back_insert_iterator_container_type<_OutputIt>::type;
2323+
using _Container = _Back_insert_iterator_container_type<_OutputIt>::type;
23242324
if constexpr (_Is_specialization_v<_Container, basic_string> || _Is_specialization_v<_Container, vector>) {
23252325
auto& _Cont = *_Back_insert_iterator_container_access<_Container>{_Output}.container;
23262326
_Cont.insert(_Cont.end(), _Data, _End);
@@ -3419,7 +3419,7 @@ struct _Default_arg_formatter {
34193419
return _Fmt_write<_CharT>(_STD move(_Out), _Val);
34203420
}
34213421

3422-
_OutputIt operator()(typename basic_format_arg<_Context>::handle _Handle) && {
3422+
_OutputIt operator()(basic_format_arg<_Context>::handle _Handle) && {
34233423
basic_format_parse_context<_CharT> _Parse_ctx({});
34243424
basic_format_context<_OutputIt, _CharT> _Format_ctx(_STD move(_Out), _Args, _Loc);
34253425
_Handle.format(_Parse_ctx, _Format_ctx);
@@ -3435,7 +3435,7 @@ struct _Arg_formatter {
34353435
_Context* _Ctx = nullptr;
34363436
_Basic_format_specs<_CharT>* _Specs = nullptr;
34373437

3438-
_OutputIt operator()(typename basic_format_arg<_Context>::handle) {
3438+
_OutputIt operator()(basic_format_arg<_Context>::handle) {
34393439
_STL_VERIFY(false, "The custom handler should be structurally unreachable for _Arg_formatter");
34403440
_STL_INTERNAL_CHECK(_Ctx);
34413441
return _Ctx->out();
@@ -3454,11 +3454,11 @@ struct _Arg_formatter {
34543454
// care about avoiding code bloat for code that never runs at runtime, and we can't form
34553455
// the erased basic_format_args structure at compile time.
34563456
template <class _Ty, class _ParseContext>
3457-
consteval typename _ParseContext::iterator _Compile_time_parse_format_specs(_ParseContext& _Pc) {
3458-
using _CharT = typename _ParseContext::char_type;
3457+
consteval _ParseContext::iterator _Compile_time_parse_format_specs(_ParseContext& _Pc) {
3458+
using _CharT = _ParseContext::char_type;
34593459
using _Context = basic_format_context<back_insert_iterator<_Fmt_buffer<_CharT>>, _CharT>;
34603460
using _ArgTraits = _Format_arg_traits<_Context>;
3461-
using _FormattedTypeMapping = typename _ArgTraits::template _Storage_type<_Ty>;
3461+
using _FormattedTypeMapping = _ArgTraits::template _Storage_type<_Ty>;
34623462
// If the type is going to use a custom formatter we should just use that,
34633463
// instead of trying to instantiate a custom formatter for its erased handle
34643464
// type
@@ -3472,7 +3472,7 @@ consteval typename _ParseContext::iterator _Compile_time_parse_format_specs(_Par
34723472
template <class _CharT, class... _Args>
34733473
struct _Format_checker {
34743474
using _ParseContext = basic_format_parse_context<_CharT>;
3475-
using _ParseFunc = typename _ParseContext::iterator (*)(_ParseContext&);
3475+
using _ParseFunc = _ParseContext::iterator (*)(_ParseContext&);
34763476

34773477
static constexpr size_t _Num_args = sizeof...(_Args);
34783478
_ParseContext _Parse_context;
@@ -3557,7 +3557,7 @@ template <class _Ty, class _CharT, _Basic_format_arg_type _ArgType>
35573557
struct _Formatter_base {
35583558
using _Pc = basic_format_parse_context<_CharT>;
35593559

3560-
constexpr typename _Pc::iterator parse(_Pc& _ParseCtx) {
3560+
constexpr _Pc::iterator parse(_Pc& _ParseCtx) {
35613561
_Specs_checker<_Dynamic_specs_handler<_Pc>> _Handler(_Dynamic_specs_handler<_Pc>{_Specs, _ParseCtx}, _ArgType);
35623562
const auto _It = _Parse_format_specs(_ParseCtx._Unchecked_begin(), _ParseCtx._Unchecked_end(), _Handler);
35633563
if (_It != _ParseCtx._Unchecked_end() && *_It != '}') {
@@ -3567,7 +3567,7 @@ struct _Formatter_base {
35673567
}
35683568

35693569
template <class _FormatContext>
3570-
typename _FormatContext::iterator format(const _Ty& _Val, _FormatContext& _FormatCtx) const {
3570+
_FormatContext::iterator format(const _Ty& _Val, _FormatContext& _FormatCtx) const {
35713571
_Dynamic_format_specs<_CharT> _Format_specs = _Specs;
35723572
if (_Specs._Dynamic_width_index >= 0) {
35733573
_Format_specs._Width =

stl/inc/xfilesystem_abi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,6 @@ struct _Fs_file {
378378
}
379379
};
380380

381-
struct _Is_slash_oper { // predicate testing if input is a preferred-separator or fallback-separator
382-
_NODISCARD constexpr bool operator()(
383-
const wchar_t _Ch) const { // test if _Ch is a preferred-separator or fallback-separator
384-
return _Ch == L'\\' || _Ch == L'/';
385-
}
386-
};
387-
388-
inline constexpr _Is_slash_oper _Is_slash{};
389381
_STD_END
390382

391383
#pragma pop_macro("new")

0 commit comments

Comments
 (0)