Fixes for g++4.6
This commit is contained in:
parent
cb5fbff1e6
commit
26a0034176
@ -35,7 +35,7 @@
|
|||||||
#define CHAISCRIPT_HAS_THREAD_LOCAL
|
#define CHAISCRIPT_HAS_THREAD_LOCAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
|
||||||
#define CHAISCRIPT_GCC_4_6
|
#define CHAISCRIPT_GCC_4_6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -68,7 +68,10 @@ namespace chaiscript
|
|||||||
|
|
||||||
#ifdef CHAISCRIPT_GCC_4_6
|
#ifdef CHAISCRIPT_GCC_4_6
|
||||||
/// \todo REMOVE THIS WHEN WE DROP G++4.6
|
/// \todo REMOVE THIS WHEN WE DROP G++4.6
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
template<typename ... Rest>
|
template<typename ... Rest>
|
||||||
struct Try_Cast;
|
struct Try_Cast;
|
||||||
@ -101,7 +104,7 @@ namespace chaiscript
|
|||||||
template<typename Ret, typename ... Params>
|
template<typename Ret, typename ... Params>
|
||||||
bool compare_types_cast(Ret (*)(Params...),
|
bool compare_types_cast(Ret (*)(Params...),
|
||||||
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions)
|
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Try_Cast<Params...>::do_try(params, 0, t_conversions);
|
Try_Cast<Params...>::do_try(params, 0, t_conversions);
|
||||||
} catch (const exception::bad_boxed_cast &) {
|
} catch (const exception::bad_boxed_cast &) {
|
||||||
@ -115,8 +118,8 @@ namespace chaiscript
|
|||||||
struct Call_Func
|
struct Call_Func
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename ... InnerParams>
|
template<typename Callable, typename ... InnerParams>
|
||||||
static Ret do_call(const std::function<Ret (Params...)> &f,
|
static Ret do_call(const Callable &f,
|
||||||
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions, InnerParams &&... innerparams)
|
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions, InnerParams &&... innerparams)
|
||||||
{
|
{
|
||||||
return Call_Func<Ret, count - 1, Params...>::do_call(f, params, t_conversions, std::forward<InnerParams>(innerparams)..., params[sizeof...(Params) - count]);
|
return Call_Func<Ret, count - 1, Params...>::do_call(f, params, t_conversions, std::forward<InnerParams>(innerparams)..., params[sizeof...(Params) - count]);
|
||||||
@ -130,8 +133,8 @@ namespace chaiscript
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4100) /// Disable unreferenced formal parameter warning, which only shows up in MSVC I don't think there's any way around it \todo evaluate this
|
#pragma warning(disable : 4100) /// Disable unreferenced formal parameter warning, which only shows up in MSVC I don't think there's any way around it \todo evaluate this
|
||||||
#endif
|
#endif
|
||||||
template<typename ... InnerParams>
|
template<typename Callable, typename ... InnerParams>
|
||||||
static Ret do_call(const std::function<Ret (Params...)> &f,
|
static Ret do_call(const Callable &f,
|
||||||
const std::vector<Boxed_Value> &, const Type_Conversions &t_conversions, InnerParams &&... innerparams)
|
const std::vector<Boxed_Value> &, const Type_Conversions &t_conversions, InnerParams &&... innerparams)
|
||||||
{
|
{
|
||||||
return f(boxed_cast<Params>(std::forward<InnerParams>(innerparams), &t_conversions)...);
|
return f(boxed_cast<Params>(std::forward<InnerParams>(innerparams), &t_conversions)...);
|
||||||
@ -147,8 +150,8 @@ namespace chaiscript
|
|||||||
* if any unboxing fails the execution of the function fails and
|
* if any unboxing fails the execution of the function fails and
|
||||||
* the bad_boxed_cast is passed up to the caller.
|
* the bad_boxed_cast is passed up to the caller.
|
||||||
*/
|
*/
|
||||||
template<typename Ret, typename ... Params>
|
template<typename Callable, typename Ret, typename ... Params>
|
||||||
Ret call_func(const std::function<Ret (Params...)> &f,
|
Ret call_func(const chaiscript::dispatch::detail::Function_Signature<Ret (Params...)> &, const Callable &f,
|
||||||
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions)
|
const std::vector<Boxed_Value> ¶ms, const Type_Conversions &t_conversions)
|
||||||
{
|
{
|
||||||
if (params.size() == sizeof...(Params))
|
if (params.size() == sizeof...(Params))
|
||||||
@ -159,6 +162,8 @@ namespace chaiscript
|
|||||||
throw exception::arity_error(static_cast<int>(params.size()), sizeof...(Params));
|
throw exception::arity_error(static_cast<int>(params.size()), sizeof...(Params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<size_t ... I>
|
template<size_t ... I>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user