mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-06 01:39:56 +08:00
Come C++17 updates, namespaces, etc
This commit is contained in:
parent
1738476321
commit
bfe7799d13
@ -70,7 +70,7 @@ namespace chaiscript {
|
|||||||
|
|
||||||
std::unique_ptr<Data> clone() const override
|
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;
|
Data_Impl &operator=(const Data_Impl&) = delete;
|
||||||
@ -94,7 +94,7 @@ namespace chaiscript {
|
|||||||
template<typename ValueType,
|
template<typename ValueType,
|
||||||
typename = std::enable_if_t<!std::is_same_v<Any, std::decay_t<ValueType>>>>
|
typename = std::enable_if_t<!std::is_same_v<Any, std::decay_t<ValueType>>>>
|
||||||
explicit Any(ValueType &&t_value)
|
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)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -674,19 +674,18 @@ namespace chaiscript
|
|||||||
struct Return_Value {
|
struct Return_Value {
|
||||||
Boxed_Value retval;
|
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'
|
/// Special type indicating a call to 'break'
|
||||||
struct Break_Loop {
|
struct Break_Loop {
|
||||||
Break_Loop() = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Special type indicating a call to 'continue'
|
/// Special type indicating a call to 'continue'
|
||||||
struct Continue_Loop {
|
struct Continue_Loop {
|
||||||
Continue_Loop() = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
/// Evaluates the given file and looks in the 'use' paths
|
/// 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)
|
for (const auto &path : m_use_paths)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -115,7 +115,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
|
|
||||||
/// Evaluates the given string, used during eval() inside of a script
|
/// 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 {
|
try {
|
||||||
return do_eval(t_e, "__EVAL__", true);
|
return do_eval(t_e, "__EVAL__", true);
|
||||||
} catch (const exception::eval_error &t_ee) {
|
} catch (const exception::eval_error &t_ee) {
|
||||||
@ -310,10 +310,10 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // CHAISCRIPT_NO_DYNLOAD
|
#else // CHAISCRIPT_NO_DYNLOAD
|
||||||
explicit ChaiScript_Basic(std::unique_ptr<parser::ChaiScript_Parser_Base> &&parser,
|
explicit ChaiScript_Basic(std::unique_ptr<parser::ChaiScript_Parser_Base> &&parser,
|
||||||
std::vector<std::string> t_module_paths = {},
|
std::vector<std::string> t_module_paths = {},
|
||||||
std::vector<std::string> t_use_paths = {},
|
std::vector<std::string> t_use_paths = {},
|
||||||
const std::vector<chaiscript::Options> &t_opts = chaiscript::default_options()) = delete;
|
const std::vector<chaiscript::Options> &t_opts = chaiscript::default_options()) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
parser::ChaiScript_Parser_Base &get_parser() noexcept
|
parser::ChaiScript_Parser_Base &get_parser() noexcept
|
||||||
|
|||||||
@ -34,11 +34,9 @@
|
|||||||
#include "chaiscript_algebraic.hpp"
|
#include "chaiscript_algebraic.hpp"
|
||||||
#include "chaiscript_common.hpp"
|
#include "chaiscript_common.hpp"
|
||||||
|
|
||||||
namespace chaiscript {
|
namespace chaiscript::exception {
|
||||||
namespace exception {
|
|
||||||
class bad_boxed_cast;
|
class bad_boxed_cast;
|
||||||
} // namespace exception
|
} // namespace chaiscript::exception
|
||||||
} // namespace chaiscript
|
|
||||||
|
|
||||||
namespace chaiscript
|
namespace chaiscript
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user