Fix MSVC2013 builds

This commit is contained in:
Jason Turner
2015-06-02 17:35:31 -06:00
parent bacf546dff
commit 38a83e3e56
4 changed files with 16 additions and 6 deletions

View File

@@ -12,6 +12,7 @@
namespace chaiscript { namespace chaiscript {
namespace dispatch { namespace dispatch {
namespace detail { namespace detail {
template<typename Class, typename ... Param> template<typename Class, typename ... Param>
struct Constructor struct Constructor
{ {
@@ -34,6 +35,19 @@ namespace chaiscript {
Ret (Class::*m_func)(Param...) const; Ret (Class::*m_func)(Param...) const;
}; };
template<typename Ret, typename ... Param>
struct Fun_Caller
{
Fun_Caller(Ret( * t_func)(Param...) ) : m_func(t_func) {}
template<typename ... Inner>
Ret operator()(Inner&& ... inner) const {
return (m_func)(std::forward<Inner>(inner)...);
}
Ret(*m_func)(Param...);
};
template<typename Ret, typename Class, typename ... Param> template<typename Ret, typename Class, typename ... Param>
struct Caller struct Caller
{ {

View File

@@ -9,7 +9,6 @@
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <string>
#include <type_traits> #include <type_traits>
#include "boxed_number.hpp" #include "boxed_number.hpp"

View File

@@ -7,7 +7,6 @@
#ifndef CHAISCRIPT_REGISTER_FUNCTION_HPP_ #ifndef CHAISCRIPT_REGISTER_FUNCTION_HPP_
#define CHAISCRIPT_REGISTER_FUNCTION_HPP_ #define CHAISCRIPT_REGISTER_FUNCTION_HPP_
#include <functional>
#include <type_traits> #include <type_traits>
#include "bind_first.hpp" #include "bind_first.hpp"
@@ -48,10 +47,10 @@ namespace chaiscript
template<typename Ret, typename ... Param> template<typename Ret, typename ... Param>
Proxy_Function fun(Ret (*func)(Param...)) Proxy_Function fun(Ret (*func)(Param...))
{ {
auto f_ref = std::ref(*func); auto fun_call = dispatch::detail::Fun_Caller<Ret, Param...>(func);
return Proxy_Function( return Proxy_Function(
chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Callable_Impl<Ret (Param...), decltype(f_ref)>>(f_ref)); chaiscript::make_shared<dispatch::Proxy_Function_Base, dispatch::Proxy_Function_Callable_Impl<Ret (Param...), decltype(fun_call)>>(fun_call));
} }

View File

@@ -7,8 +7,6 @@
#ifndef CHAISCRIPT_PARSER_HPP_ #ifndef CHAISCRIPT_PARSER_HPP_
#define CHAISCRIPT_PARSER_HPP_ #define CHAISCRIPT_PARSER_HPP_
#include <cstdint>
#include <cstring>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <memory> #include <memory>