From bfe7799d13b177809bb0e0eb02243d59b7bfe4ca Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sat, 2 Sep 2017 13:12:52 -0600 Subject: [PATCH] Come C++17 updates, namespaces, etc --- include/chaiscript/dispatchkit/any.hpp | 4 ++-- include/chaiscript/language/chaiscript_common.hpp | 5 ++--- include/chaiscript/language/chaiscript_engine.hpp | 12 ++++++------ include/chaiscript/language/chaiscript_eval.hpp | 6 ++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/chaiscript/dispatchkit/any.hpp b/include/chaiscript/dispatchkit/any.hpp index 823679eb..d13b653f 100644 --- a/include/chaiscript/dispatchkit/any.hpp +++ b/include/chaiscript/dispatchkit/any.hpp @@ -70,7 +70,7 @@ namespace chaiscript { std::unique_ptr clone() const override { - return std::unique_ptr(new Data_Impl(m_data)); + return std::make_unique>(m_data); } Data_Impl &operator=(const Data_Impl&) = delete; @@ -94,7 +94,7 @@ namespace chaiscript { template>>> explicit Any(ValueType &&t_value) - : m_data(std::unique_ptr(new Data_Impl>(std::forward(t_value)))) + : m_data(std::make_unique>>(std::forward(t_value))) { } diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index 837ebeea..dbbfc744 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -674,19 +674,18 @@ namespace chaiscript struct Return_Value { Boxed_Value retval; - explicit Return_Value(Boxed_Value t_return_value) : retval(std::move(t_return_value)) { } + + explicit Return_Value(Boxed_Value &&t_return_value) : retval(std::move(t_return_value)) { } }; /// Special type indicating a call to 'break' struct Break_Loop { - Break_Loop() = default; }; /// Special type indicating a call to 'continue' struct Continue_Loop { - Continue_Loop() = default; }; diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index cfdffc0e..47cf43a3 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -94,7 +94,7 @@ namespace chaiscript /// Evaluates the given file and looks in the 'use' paths - const Boxed_Value internal_eval_file(const std::string &t_filename) { + Boxed_Value internal_eval_file(const std::string &t_filename) { for (const auto &path : m_use_paths) { try { @@ -115,7 +115,7 @@ namespace chaiscript /// Evaluates the given string, used during eval() inside of a script - const Boxed_Value internal_eval(const std::string &t_e) { + Boxed_Value internal_eval(const std::string &t_e) { try { return do_eval(t_e, "__EVAL__", true); } catch (const exception::eval_error &t_ee) { @@ -310,10 +310,10 @@ namespace chaiscript } } #else // CHAISCRIPT_NO_DYNLOAD -explicit ChaiScript_Basic(std::unique_ptr &&parser, - std::vector t_module_paths = {}, - std::vector t_use_paths = {}, - const std::vector &t_opts = chaiscript::default_options()) = delete; + explicit ChaiScript_Basic(std::unique_ptr &&parser, + std::vector t_module_paths = {}, + std::vector t_use_paths = {}, + const std::vector &t_opts = chaiscript::default_options()) = delete; #endif parser::ChaiScript_Parser_Base &get_parser() noexcept diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 1b05cac7..42c18790 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -34,11 +34,9 @@ #include "chaiscript_algebraic.hpp" #include "chaiscript_common.hpp" -namespace chaiscript { -namespace exception { +namespace chaiscript::exception { class bad_boxed_cast; -} // namespace exception -} // namespace chaiscript +} // namespace chaiscript::exception namespace chaiscript {