From a31fc5cc8643beae13b8f071fbeac50aac1a94e2 Mon Sep 17 00:00:00 2001 From: Kirill Trofimov Date: Mon, 23 Oct 2023 18:07:17 +0300 Subject: [PATCH] fix: Use `using` instead of `typedef` for type aliasing. Since C++ 11 we shouldn't use c-style `typedefs`. In addition, `using` can be templated. --- src/libutil/args.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libutil/args.hh b/src/libutil/args.hh index 021c2a937..cee672d80 100644 --- a/src/libutil/args.hh +++ b/src/libutil/args.hh @@ -130,7 +130,7 @@ protected: * The `AddCompletions` that is passed is an interface to the state * stored as part of the root command */ - typedef void CompleterFun(AddCompletions &, size_t, std::string_view); + using CompleterFun = void(AddCompletions &, size_t, std::string_view); /** * The closure type of the completion callback. @@ -138,7 +138,7 @@ protected: * This is what is actually stored as part of each Flag / Expected * Arg. */ - typedef std::function CompleterClosure; + using CompleterClosure = std::function; /** * Description of flags / options @@ -148,7 +148,7 @@ protected: */ struct Flag { - typedef std::shared_ptr ptr; + using ptr = std::shared_ptr; std::string longName; std::set aliases; @@ -303,7 +303,7 @@ struct Command : virtual public Args */ virtual void run() = 0; - typedef int Category; + using Category = int; static constexpr Category catDefault = 0; @@ -312,7 +312,7 @@ struct Command : virtual public Args virtual Category category() { return catDefault; } }; -typedef std::map()>> Commands; +using Commands = std::map()>>; /** * An argument parser that supports multiple subcommands,