From f54aa907365929bd10e7b2d17ca210896efd8485 Mon Sep 17 00:00:00 2001 From: Mario Lang Date: Mon, 25 Sep 2017 16:55:18 +0200 Subject: [PATCH] Use using --- include/chaiscript/dispatchkit/bootstrap.hpp | 2 +- .../chaiscript/dispatchkit/bootstrap_stl.hpp | 14 ++++++------- .../chaiscript/dispatchkit/dispatchkit.hpp | 20 +++++++++---------- .../dispatchkit/exception_specification.hpp | 2 +- .../dispatchkit/proxy_functions.hpp | 6 +++--- .../dispatchkit/type_conversions.hpp | 2 +- include/chaiscript/dispatchkit/type_info.hpp | 2 +- .../chaiscript/language/chaiscript_common.hpp | 6 +++--- .../chaiscript/language/chaiscript_parser.hpp | 6 +++--- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index 67116da6..79e157c4 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -22,7 +22,7 @@ namespace chaiscript template::value>::type > void array(const std::string &type, Module& m) { - typedef typename std::remove_extent::type ReturnType; + using ReturnType = typename std::remove_extent::type; m.add(user_type(), type); m.add(fun( diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index df25c9ec..78a85fca 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -44,7 +44,7 @@ namespace chaiscript template struct Bidir_Range { - typedef Container container_type; + using container_type = Container; constexpr Bidir_Range(Container &c) : m_begin(c.begin()), m_end(c.end()) @@ -355,7 +355,7 @@ namespace chaiscript , "back"); - typedef void (ContainerType::*push_back)(const typename ContainerType::value_type &); + using push_back = void (ContainerType::*)(const typename ContainerType::value_type &); m.add(fun(static_cast(&ContainerType::push_back)), [&]()->std::string{ if (typeid(typename ContainerType::value_type) == typeid(Boxed_Value)) { @@ -395,8 +395,8 @@ namespace chaiscript template void front_insertion_sequence_type(const std::string &type, Module& m) { - typedef void (ContainerType::*push_ptr)(typename ContainerType::const_reference); - typedef void (ContainerType::*pop_ptr)(); + using push_ptr = void (ContainerType::*)(typename ContainerType::const_reference); + using pop_ptr = void (ContainerType::*)(); m.add(fun([](ContainerType &container)->decltype(auto){ if (container.empty()) { @@ -498,7 +498,7 @@ namespace chaiscript { m.add(fun(detail::count), "count"); - typedef size_t (ContainerType::*erase_ptr)(const typename ContainerType::key_type &); + using erase_ptr = size_t (ContainerType::*)(const typename ContainerType::key_type &); m.add(fun(static_cast(&ContainerType::erase)), "erase"); @@ -529,8 +529,8 @@ namespace chaiscript { m.add(user_type(), type); - typedef typename MapType::mapped_type &(MapType::*elem_access)(const typename MapType::key_type &); - typedef const typename MapType::mapped_type &(MapType::*const_elem_access)(const typename MapType::key_type &) const; + using elem_access = typename MapType::mapped_type &(MapType::*)(const typename MapType::key_type &); + using const_elem_access = const typename MapType::mapped_type &(MapType::*)(const typename MapType::key_type &) const; m.add(fun(static_cast(&MapType::operator[])), "[]"); diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 5b25127b..8c8748d1 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -261,7 +261,7 @@ namespace chaiscript }; /// Convenience typedef for Module objects to be added to the ChaiScript runtime - typedef std::shared_ptr ModulePtr; + using ModulePtr = std::shared_ptr; namespace detail { @@ -388,11 +388,11 @@ namespace chaiscript using SmallVector = std::vector; - typedef SmallVector> Scope; - typedef SmallVector StackData; - typedef SmallVector Stacks; - typedef SmallVector Call_Param_List; - typedef SmallVector Call_Params; + using Scope = SmallVector>; + using StackData = SmallVector; + using Stacks = SmallVector; + using Call_Param_List = SmallVector; + using Call_Params = SmallVector; Stack_Holder() { @@ -439,9 +439,9 @@ namespace chaiscript { public: - typedef std::map Type_Name_Map; - typedef std::vector> Scope; - typedef Stack_Holder::StackData StackData; + using Type_Name_Map = std::map; + using Scope = std::vector>; + using StackData = Stack_Holder::StackData; struct State { @@ -1417,7 +1417,7 @@ namespace chaiscript t_c.reserve(t_c.size() + 1); // tightly control growth of memory usage here t_c.emplace_back(t_key, std::forward(t_value)); } else { - typedef typename Container::value_type value_type; + using value_type = typename Container::value_type; *itr = value_type(t_key, std::forward(t_value)); } } diff --git a/include/chaiscript/dispatchkit/exception_specification.hpp b/include/chaiscript/dispatchkit/exception_specification.hpp index 0eeecdc4..608a1d44 100644 --- a/include/chaiscript/dispatchkit/exception_specification.hpp +++ b/include/chaiscript/dispatchkit/exception_specification.hpp @@ -101,7 +101,7 @@ namespace chaiscript /// /// \sa chaiscript::exception_specification for creation of chaiscript::Exception_Handler objects /// \sa \ref exceptions - typedef std::shared_ptr Exception_Handler; + using Exception_Handler = std::shared_ptr; /// \brief creates a chaiscript::Exception_Handler which handles one type of exception unboxing /// \sa \ref exceptions diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index b2383ce1..1f413069 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -41,7 +41,7 @@ namespace chaiscript class Boxed_Number; struct AST_Node; - typedef std::unique_ptr AST_NodePtr; + using AST_NodePtr = std::unique_ptr; namespace dispatch { @@ -318,11 +318,11 @@ namespace chaiscript } /// \brief Common typedef used for passing of any registered function in ChaiScript - typedef std::shared_ptr Proxy_Function; + using Proxy_Function = std::shared_ptr; /// \brief Const version of Proxy_Function. Points to a const Proxy_Function. This is how most registered functions /// are handled internally. - typedef std::shared_ptr Const_Proxy_Function; + using Const_Proxy_Function = std::shared_ptr; namespace exception { diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index d1f88233..6dc2138c 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -538,7 +538,7 @@ namespace chaiscript std::reference_wrapper m_saves; }; - typedef std::shared_ptr Type_Conversion; + using Type_Conversion = std::shared_ptr; /// \brief Used to register a to / parent class relationship with ChaiScript. Necessary if you /// want automatic conversions up your inheritance hierarchy. diff --git a/include/chaiscript/dispatchkit/type_info.hpp b/include/chaiscript/dispatchkit/type_info.hpp index f8fc868d..ebf1b2cd 100644 --- a/include/chaiscript/dispatchkit/type_info.hpp +++ b/include/chaiscript/dispatchkit/type_info.hpp @@ -24,7 +24,7 @@ namespace chaiscript template struct Bare_Type { - typedef typename std::remove_cv::type>::type>::type type; + using type = typename std::remove_cv::type>::type>::type; }; } diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index dbbfc744..cfc60ab2 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -84,7 +84,7 @@ namespace chaiscript }; /// Signature of module entry point that all binary loadable modules must implement. - typedef ModulePtr (*Create_Module_Func)(); + using Create_Module_Func = ModulePtr (*)(); /// Types of AST nodes available to the parser and eval @@ -150,8 +150,8 @@ namespace chaiscript /// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree - typedef std::unique_ptr AST_NodePtr; - typedef std::unique_ptr AST_NodePtr_Const; + using AST_NodePtr = std::unique_ptr; + using AST_NodePtr_Const = std::unique_ptr; struct AST_Node_Trace; diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index ebcef83f..09bcc370 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -76,7 +76,7 @@ namespace chaiscript // common for all implementations static std::string u8str_from_ll(long long val) { - typedef std::string::value_type char_type; + using char_type = std::string::value_type; char_type c[2]; c[1] = char_type(val); @@ -92,7 +92,7 @@ namespace chaiscript static string_type str_from_ll(long long val) { - typedef typename string_type::value_type target_char_type; + using target_char_type = typename string_type::value_type; #if defined (CHAISCRIPT_UTF16_UTF32) // prepare converter std::wstring_convert, target_char_type> converter; @@ -1065,7 +1065,7 @@ namespace chaiscript struct Char_Parser { string_type &match; - typedef typename string_type::value_type char_type; + using char_type = typename string_type::value_type; bool is_escaped = false; bool is_interpolated = false; bool saw_interpolation_marker = false;