mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
Use using
This commit is contained in:
parent
8e590387f1
commit
f54aa90736
@ -22,7 +22,7 @@ namespace chaiscript
|
|||||||
template<typename T, typename = typename std::enable_if<std::is_array<T>::value>::type >
|
template<typename T, typename = typename std::enable_if<std::is_array<T>::value>::type >
|
||||||
void array(const std::string &type, Module& m)
|
void array(const std::string &type, Module& m)
|
||||||
{
|
{
|
||||||
typedef typename std::remove_extent<T>::type ReturnType;
|
using ReturnType = typename std::remove_extent<T>::type;
|
||||||
|
|
||||||
m.add(user_type<T>(), type);
|
m.add(user_type<T>(), type);
|
||||||
m.add(fun(
|
m.add(fun(
|
||||||
|
|||||||
@ -44,7 +44,7 @@ namespace chaiscript
|
|||||||
template<typename Container, typename IterType>
|
template<typename Container, typename IterType>
|
||||||
struct Bidir_Range
|
struct Bidir_Range
|
||||||
{
|
{
|
||||||
typedef Container container_type;
|
using container_type = Container;
|
||||||
|
|
||||||
constexpr Bidir_Range(Container &c)
|
constexpr Bidir_Range(Container &c)
|
||||||
: m_begin(c.begin()), m_end(c.end())
|
: m_begin(c.begin()), m_end(c.end())
|
||||||
@ -355,7 +355,7 @@ namespace chaiscript
|
|||||||
, "back");
|
, "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<push_back>(&ContainerType::push_back)),
|
m.add(fun(static_cast<push_back>(&ContainerType::push_back)),
|
||||||
[&]()->std::string{
|
[&]()->std::string{
|
||||||
if (typeid(typename ContainerType::value_type) == typeid(Boxed_Value)) {
|
if (typeid(typename ContainerType::value_type) == typeid(Boxed_Value)) {
|
||||||
@ -395,8 +395,8 @@ namespace chaiscript
|
|||||||
template<typename ContainerType>
|
template<typename ContainerType>
|
||||||
void front_insertion_sequence_type(const std::string &type, Module& m)
|
void front_insertion_sequence_type(const std::string &type, Module& m)
|
||||||
{
|
{
|
||||||
typedef void (ContainerType::*push_ptr)(typename ContainerType::const_reference);
|
using push_ptr = void (ContainerType::*)(typename ContainerType::const_reference);
|
||||||
typedef void (ContainerType::*pop_ptr)();
|
using pop_ptr = void (ContainerType::*)();
|
||||||
|
|
||||||
m.add(fun([](ContainerType &container)->decltype(auto){
|
m.add(fun([](ContainerType &container)->decltype(auto){
|
||||||
if (container.empty()) {
|
if (container.empty()) {
|
||||||
@ -498,7 +498,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
m.add(fun(detail::count<ContainerType>), "count");
|
m.add(fun(detail::count<ContainerType>), "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<erase_ptr>(&ContainerType::erase)), "erase");
|
m.add(fun(static_cast<erase_ptr>(&ContainerType::erase)), "erase");
|
||||||
|
|
||||||
@ -529,8 +529,8 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
m.add(user_type<MapType>(), type);
|
m.add(user_type<MapType>(), type);
|
||||||
|
|
||||||
typedef typename MapType::mapped_type &(MapType::*elem_access)(const typename MapType::key_type &);
|
using elem_access = typename MapType::mapped_type &(MapType::*)(const typename MapType::key_type &);
|
||||||
typedef const typename MapType::mapped_type &(MapType::*const_elem_access)(const typename MapType::key_type &) const;
|
using const_elem_access = const typename MapType::mapped_type &(MapType::*)(const typename MapType::key_type &) const;
|
||||||
|
|
||||||
m.add(fun(static_cast<elem_access>(&MapType::operator[])), "[]");
|
m.add(fun(static_cast<elem_access>(&MapType::operator[])), "[]");
|
||||||
|
|
||||||
|
|||||||
@ -261,7 +261,7 @@ namespace chaiscript
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Convenience typedef for Module objects to be added to the ChaiScript runtime
|
/// Convenience typedef for Module objects to be added to the ChaiScript runtime
|
||||||
typedef std::shared_ptr<Module> ModulePtr;
|
using ModulePtr = std::shared_ptr<Module>;
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -388,11 +388,11 @@ namespace chaiscript
|
|||||||
using SmallVector = std::vector<T>;
|
using SmallVector = std::vector<T>;
|
||||||
|
|
||||||
|
|
||||||
typedef SmallVector<std::pair<std::string, Boxed_Value>> Scope;
|
using Scope = SmallVector<std::pair<std::string, Boxed_Value>>;
|
||||||
typedef SmallVector<Scope> StackData;
|
using StackData = SmallVector<Scope>;
|
||||||
typedef SmallVector<StackData> Stacks;
|
using Stacks = SmallVector<StackData>;
|
||||||
typedef SmallVector<Boxed_Value> Call_Param_List;
|
using Call_Param_List = SmallVector<Boxed_Value>;
|
||||||
typedef SmallVector<Call_Param_List> Call_Params;
|
using Call_Params = SmallVector<Call_Param_List>;
|
||||||
|
|
||||||
Stack_Holder()
|
Stack_Holder()
|
||||||
{
|
{
|
||||||
@ -439,9 +439,9 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::map<std::string, chaiscript::Type_Info, str_less> Type_Name_Map;
|
using Type_Name_Map = std::map<std::string, chaiscript::Type_Info, str_less>;
|
||||||
typedef std::vector<std::pair<std::string, Boxed_Value>> Scope;
|
using Scope = std::vector<std::pair<std::string, Boxed_Value>>;
|
||||||
typedef Stack_Holder::StackData StackData;
|
using StackData = Stack_Holder::StackData;
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
@ -1417,7 +1417,7 @@ namespace chaiscript
|
|||||||
t_c.reserve(t_c.size() + 1); // tightly control growth of memory usage here
|
t_c.reserve(t_c.size() + 1); // tightly control growth of memory usage here
|
||||||
t_c.emplace_back(t_key, std::forward<Value>(t_value));
|
t_c.emplace_back(t_key, std::forward<Value>(t_value));
|
||||||
} else {
|
} else {
|
||||||
typedef typename Container::value_type value_type;
|
using value_type = typename Container::value_type;
|
||||||
*itr = value_type(t_key, std::forward<Value>(t_value));
|
*itr = value_type(t_key, std::forward<Value>(t_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ namespace chaiscript
|
|||||||
///
|
///
|
||||||
/// \sa chaiscript::exception_specification for creation of chaiscript::Exception_Handler objects
|
/// \sa chaiscript::exception_specification for creation of chaiscript::Exception_Handler objects
|
||||||
/// \sa \ref exceptions
|
/// \sa \ref exceptions
|
||||||
typedef std::shared_ptr<detail::Exception_Handler_Base> Exception_Handler;
|
using Exception_Handler = std::shared_ptr<detail::Exception_Handler_Base>;
|
||||||
|
|
||||||
/// \brief creates a chaiscript::Exception_Handler which handles one type of exception unboxing
|
/// \brief creates a chaiscript::Exception_Handler which handles one type of exception unboxing
|
||||||
/// \sa \ref exceptions
|
/// \sa \ref exceptions
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace chaiscript
|
|||||||
class Boxed_Number;
|
class Boxed_Number;
|
||||||
struct AST_Node;
|
struct AST_Node;
|
||||||
|
|
||||||
typedef std::unique_ptr<AST_Node> AST_NodePtr;
|
using AST_NodePtr = std::unique_ptr<AST_Node>;
|
||||||
|
|
||||||
namespace dispatch
|
namespace dispatch
|
||||||
{
|
{
|
||||||
@ -318,11 +318,11 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Common typedef used for passing of any registered function in ChaiScript
|
/// \brief Common typedef used for passing of any registered function in ChaiScript
|
||||||
typedef std::shared_ptr<dispatch::Proxy_Function_Base> Proxy_Function;
|
using Proxy_Function = std::shared_ptr<dispatch::Proxy_Function_Base>;
|
||||||
|
|
||||||
/// \brief Const version of Proxy_Function. Points to a const Proxy_Function. This is how most registered functions
|
/// \brief Const version of Proxy_Function. Points to a const Proxy_Function. This is how most registered functions
|
||||||
/// are handled internally.
|
/// are handled internally.
|
||||||
typedef std::shared_ptr<const dispatch::Proxy_Function_Base> Const_Proxy_Function;
|
using Const_Proxy_Function = std::shared_ptr<const dispatch::Proxy_Function_Base>;
|
||||||
|
|
||||||
namespace exception
|
namespace exception
|
||||||
{
|
{
|
||||||
|
|||||||
@ -538,7 +538,7 @@ namespace chaiscript
|
|||||||
std::reference_wrapper<Type_Conversions::Conversion_Saves> m_saves;
|
std::reference_wrapper<Type_Conversions::Conversion_Saves> m_saves;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<chaiscript::detail::Type_Conversion_Base> Type_Conversion;
|
using Type_Conversion = std::shared_ptr<chaiscript::detail::Type_Conversion_Base>;
|
||||||
|
|
||||||
/// \brief Used to register a to / parent class relationship with ChaiScript. Necessary if you
|
/// \brief Used to register a to / parent class relationship with ChaiScript. Necessary if you
|
||||||
/// want automatic conversions up your inheritance hierarchy.
|
/// want automatic conversions up your inheritance hierarchy.
|
||||||
|
|||||||
@ -24,7 +24,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct Bare_Type
|
struct Bare_Type
|
||||||
{
|
{
|
||||||
typedef typename std::remove_cv<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::type type;
|
using type = typename std::remove_cv<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::type;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ namespace chaiscript
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Signature of module entry point that all binary loadable modules must implement.
|
/// 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
|
/// 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
|
/// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree
|
||||||
typedef std::unique_ptr<AST_Node> AST_NodePtr;
|
using AST_NodePtr = std::unique_ptr<AST_Node>;
|
||||||
typedef std::unique_ptr<const AST_Node> AST_NodePtr_Const;
|
using AST_NodePtr_Const = std::unique_ptr<const AST_Node>;
|
||||||
|
|
||||||
struct AST_Node_Trace;
|
struct AST_Node_Trace;
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ namespace chaiscript
|
|||||||
// common for all implementations
|
// common for all implementations
|
||||||
static std::string u8str_from_ll(long long val)
|
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];
|
char_type c[2];
|
||||||
c[1] = char_type(val);
|
c[1] = char_type(val);
|
||||||
@ -92,7 +92,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
static string_type str_from_ll(long long val)
|
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)
|
#if defined (CHAISCRIPT_UTF16_UTF32)
|
||||||
// prepare converter
|
// prepare converter
|
||||||
std::wstring_convert<std::codecvt_utf8<target_char_type>, target_char_type> converter;
|
std::wstring_convert<std::codecvt_utf8<target_char_type>, target_char_type> converter;
|
||||||
@ -1065,7 +1065,7 @@ namespace chaiscript
|
|||||||
struct Char_Parser
|
struct Char_Parser
|
||||||
{
|
{
|
||||||
string_type &match;
|
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_escaped = false;
|
||||||
bool is_interpolated = false;
|
bool is_interpolated = false;
|
||||||
bool saw_interpolation_marker = false;
|
bool saw_interpolation_marker = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user