Come C++17 updates, namespaces, etc

This commit is contained in:
Jason Turner 2017-09-02 13:12:52 -06:00
parent 1738476321
commit bfe7799d13
4 changed files with 12 additions and 15 deletions

View File

@ -70,7 +70,7 @@ namespace chaiscript {
std::unique_ptr<Data> clone() const override
{
return std::unique_ptr<Data>(new Data_Impl<T>(m_data));
return std::make_unique<Data_Impl<T>>(m_data);
}
Data_Impl &operator=(const Data_Impl&) = delete;
@ -94,7 +94,7 @@ namespace chaiscript {
template<typename ValueType,
typename = std::enable_if_t<!std::is_same_v<Any, std::decay_t<ValueType>>>>
explicit Any(ValueType &&t_value)
: m_data(std::unique_ptr<Data>(new Data_Impl<std::decay_t<ValueType>>(std::forward<ValueType>(t_value))))
: m_data(std::make_unique<Data_Impl<std::decay_t<ValueType>>>(std::forward<ValueType>(t_value)))
{
}

View File

@ -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;
};

View File

@ -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::ChaiScript_Parser_Base> &&parser,
std::vector<std::string> t_module_paths = {},
std::vector<std::string> t_use_paths = {},
const std::vector<chaiscript::Options> &t_opts = chaiscript::default_options()) = delete;
explicit ChaiScript_Basic(std::unique_ptr<parser::ChaiScript_Parser_Base> &&parser,
std::vector<std::string> t_module_paths = {},
std::vector<std::string> t_use_paths = {},
const std::vector<chaiscript::Options> &t_opts = chaiscript::default_options()) = delete;
#endif
parser::ChaiScript_Parser_Base &get_parser() noexcept

View File

@ -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
{