Merge remote-tracking branch 'origin/c++17' into best_practices

This commit is contained in:
Jason Turner 2017-11-21 14:59:04 -07:00
commit f37bb847c7
9 changed files with 30 additions and 30 deletions

View File

@ -22,7 +22,7 @@ namespace chaiscript
template<typename T, typename = typename std::enable_if<std::is_array<T>::value>::type >
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(fun(

View File

@ -44,7 +44,7 @@ namespace chaiscript
template<typename Container, typename IterType>
struct Bidir_Range
{
typedef Container container_type;
using container_type = Container;
constexpr Bidir_Range(Container &c)
: m_begin(c.begin()), m_end(c.end())
@ -292,7 +292,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<push_back>(&ContainerType::push_back)),
[&]()->std::string{
if (typeid(typename ContainerType::value_type) == typeid(Boxed_Value)) {
@ -324,8 +324,8 @@ namespace chaiscript
template<typename ContainerType>
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()) {
@ -403,7 +403,7 @@ namespace chaiscript
{
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");
@ -426,8 +426,8 @@ namespace chaiscript
{
m.add(user_type<MapType>(), 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<elem_access>(&MapType::operator[])), "[]");

View File

@ -261,7 +261,7 @@ namespace chaiscript
};
/// 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
{
@ -388,11 +388,11 @@ namespace chaiscript
using SmallVector = std::vector<T>;
typedef SmallVector<std::pair<std::string, Boxed_Value>> Scope;
typedef SmallVector<Scope> StackData;
typedef SmallVector<StackData> Stacks;
typedef SmallVector<Boxed_Value> Call_Param_List;
typedef SmallVector<Call_Param_List> Call_Params;
using Scope = SmallVector<std::pair<std::string, Boxed_Value>>;
using StackData = SmallVector<Scope>;
using Stacks = SmallVector<StackData>;
using Call_Param_List = SmallVector<Boxed_Value>;
using Call_Params = SmallVector<Call_Param_List>;
Stack_Holder()
{
@ -439,9 +439,9 @@ namespace chaiscript
{
public:
typedef std::map<std::string, chaiscript::Type_Info, str_less> Type_Name_Map;
typedef std::vector<std::pair<std::string, Boxed_Value>> Scope;
typedef Stack_Holder::StackData StackData;
using Type_Name_Map = std::map<std::string, chaiscript::Type_Info, str_less>;
using Scope = std::vector<std::pair<std::string, Boxed_Value>>;
using StackData = Stack_Holder::StackData;
struct State
{
@ -1485,7 +1485,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<Value>(t_value));
} 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));
}
}

View File

@ -101,7 +101,7 @@ namespace chaiscript
///
/// \sa chaiscript::exception_specification for creation of chaiscript::Exception_Handler objects
/// \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
/// \sa \ref exceptions

View File

@ -42,7 +42,7 @@ namespace chaiscript
class Boxed_Number;
struct AST_Node;
typedef std::unique_ptr<AST_Node> AST_NodePtr;
using AST_NodePtr = std::unique_ptr<AST_Node>;
namespace dispatch
{
@ -338,11 +338,11 @@ namespace 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
/// 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
{

View File

@ -538,7 +538,7 @@ namespace chaiscript
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
/// want automatic conversions up your inheritance hierarchy.

View File

@ -24,7 +24,7 @@ namespace chaiscript
template<typename T>
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;
};
}

View File

@ -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_Node> AST_NodePtr;
typedef std::unique_ptr<const AST_Node> AST_NodePtr_Const;
using AST_NodePtr = std::unique_ptr<AST_Node>;
using AST_NodePtr_Const = std::unique_ptr<const AST_Node>;
struct AST_Node_Trace;

View File

@ -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<std::codecvt_utf8<target_char_type>, 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;