mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Get VS compiling
This commit is contained in:
parent
b7e26b9076
commit
27072a77e6
@ -271,7 +271,7 @@ namespace chaiscript {
|
|||||||
|
|
||||||
|
|
||||||
template<typename ... T>
|
template<typename ... T>
|
||||||
[[nodiscard]] auto make_vector(T && ... t)
|
[[nodiscard]] auto make_vector(T &&... t) -> std::vector<std::common_type_t<std::decay_t<T>...>>
|
||||||
{
|
{
|
||||||
using container_type =
|
using container_type =
|
||||||
std::vector<std::common_type_t<std::decay_t<T>...>>;
|
std::vector<std::common_type_t<std::decay_t<T>...>>;
|
||||||
|
|||||||
@ -1303,8 +1303,8 @@ namespace chaiscript
|
|||||||
const auto lhssize = lhsparamtypes.size();
|
const auto lhssize = lhsparamtypes.size();
|
||||||
const auto rhssize = rhsparamtypes.size();
|
const auto rhssize = rhsparamtypes.size();
|
||||||
|
|
||||||
constexpr const auto boxed_type = user_type<Boxed_Value>();
|
const auto boxed_type = user_type<Boxed_Value>();
|
||||||
constexpr const auto boxed_pod_type = user_type<Boxed_Number>();
|
const auto boxed_pod_type = user_type<Boxed_Number>();
|
||||||
|
|
||||||
for (size_t i = 1; i < lhssize && i < rhssize; ++i)
|
for (size_t i = 1; i < lhssize && i < rhssize; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace chaiscript {
|
|||||||
|
|
||||||
template<size_t Size>
|
template<size_t Size>
|
||||||
constexpr explicit Function_Params(const std::array<Boxed_Value, Size> &a)
|
constexpr explicit Function_Params(const std::array<Boxed_Value, Size> &a)
|
||||||
: m_begin(std::begin(a)), m_end(std::end(a))
|
: m_begin(&*std::begin(a)), m_end(&*std::end(a))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ namespace chaiscript
|
|||||||
std::vector<Boxed_Value> convert(Function_Params t_params, const Type_Conversions_State &t_conversions) const
|
std::vector<Boxed_Value> convert(Function_Params t_params, const Type_Conversions_State &t_conversions) const
|
||||||
{
|
{
|
||||||
auto vals = t_params.to_vector();
|
auto vals = t_params.to_vector();
|
||||||
constexpr auto dynamic_object_type_info = user_type<Dynamic_Object>();
|
const auto dynamic_object_type_info = user_type<Dynamic_Object>();
|
||||||
for (size_t i = 0; i < vals.size(); ++i)
|
for (size_t i = 0; i < vals.size(); ++i)
|
||||||
{
|
{
|
||||||
const auto &name = m_types[i].first;
|
const auto &name = m_types[i].first;
|
||||||
@ -117,7 +117,7 @@ namespace chaiscript
|
|||||||
// second result: needs conversions
|
// second result: needs conversions
|
||||||
std::pair<bool, bool> match(const Function_Params &vals, const Type_Conversions_State &t_conversions) const noexcept
|
std::pair<bool, bool> match(const Function_Params &vals, const Type_Conversions_State &t_conversions) const noexcept
|
||||||
{
|
{
|
||||||
constexpr auto dynamic_object_type_info = user_type<Dynamic_Object>();
|
const auto dynamic_object_type_info = user_type<Dynamic_Object>();
|
||||||
bool needs_conversion = false;
|
bool needs_conversion = false;
|
||||||
|
|
||||||
if (!m_has_types) { return std::make_pair(true, needs_conversion); }
|
if (!m_has_types) { return std::make_pair(true, needs_conversion); }
|
||||||
@ -252,9 +252,9 @@ namespace chaiscript
|
|||||||
|
|
||||||
static bool compare_type_to_param(const Type_Info &ti, const Boxed_Value &bv, const Type_Conversions_State &t_conversions) noexcept
|
static bool compare_type_to_param(const Type_Info &ti, const Boxed_Value &bv, const Type_Conversions_State &t_conversions) noexcept
|
||||||
{
|
{
|
||||||
constexpr auto boxed_value_ti = user_type<Boxed_Value>();
|
const auto boxed_value_ti = user_type<Boxed_Value>();
|
||||||
constexpr auto boxed_number_ti = user_type<Boxed_Number>();
|
const auto boxed_number_ti = user_type<Boxed_Number>();
|
||||||
constexpr auto function_ti = user_type<std::shared_ptr<const Proxy_Function_Base>>();
|
const auto function_ti = user_type<std::shared_ptr<const Proxy_Function_Base>>();
|
||||||
|
|
||||||
if (ti.is_undef()
|
if (ti.is_undef()
|
||||||
|| ti.bare_equal(boxed_value_ti)
|
|| ti.bare_equal(boxed_value_ti)
|
||||||
@ -757,7 +757,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
constexpr auto class_type_info = user_type<Class>();
|
const auto class_type_info = user_type<Class>();
|
||||||
return vals[0].get_type_info().bare_equal(class_type_info);
|
return vals[0].get_type_info().bare_equal(class_type_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,8 @@ namespace chaiscript
|
|||||||
// we now that the Param pack will have only one element, so we are safe expanding it here
|
// we now that the Param pack will have only one element, so we are safe expanding it here
|
||||||
return Proxy_Function(chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Attribute_Access<Ret, std::decay_t<Param>...>>(std::forward<Func>(func)));
|
return Proxy_Function(chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Attribute_Access<Ret, std::decay_t<Param>...>>(std::forward<Func>(func)));
|
||||||
} else if constexpr (Is_Member) {
|
} else if constexpr (Is_Member) {
|
||||||
auto call = [func = std::forward<Func>(func)](auto && obj, auto && ... param) noexcept(Is_Noexcept) -> decltype(auto) {
|
// TODO some kind of bug is preventing forwarding of this noexcept for the lambda
|
||||||
|
auto call = [func = std::forward<Func>(func)](auto && obj, auto && ... param) /* noexcept(Is_Noexcept) */ -> decltype(auto) {
|
||||||
return (( get_first_param(Function_Params<Param...>{}, obj).*func )(std::forward<decltype(param)>(param)...));
|
return (( get_first_param(Function_Params<Param...>{}, obj).*func )(std::forward<decltype(param)>(param)...));
|
||||||
};
|
};
|
||||||
return Proxy_Function(
|
return Proxy_Function(
|
||||||
|
|||||||
@ -388,7 +388,7 @@ namespace chaiscript
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
bool convertable_type() const noexcept
|
bool convertable_type() const noexcept
|
||||||
{
|
{
|
||||||
constexpr auto type = user_type<T>().bare_type_info();
|
const auto type = user_type<T>().bare_type_info();
|
||||||
return thread_cache().count(type) != 0;
|
return thread_cache().count(type) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user