Simplify how functions are stored and passed. This is the first step in allowing us to sort functions so that dispatches are attempted in an organized order (as opposed to just the order they were added in).

Should have resulted in a speed imrovement too - fewer string copies during dispatch.
This commit is contained in:
Jason Turner
2010-11-15 05:52:48 +00:00
parent 3aee589274
commit 7ef1b81504
4 changed files with 81 additions and 63 deletions

View File

@@ -30,7 +30,7 @@ namespace chaiscript
*/
template<typename FunctionType>
boost::function<FunctionType>
functor(const std::vector<std::pair<std::string, Const_Proxy_Function > > &funcs)
functor(const std::vector<Const_Proxy_Function> &funcs)
{
FunctionType *p=0;
return detail::build_function_caller_helper(p, funcs);
@@ -53,8 +53,8 @@ namespace chaiscript
boost::function<FunctionType>
functor(Const_Proxy_Function func)
{
std::vector<std::pair<std::string, Const_Proxy_Function > > funcs;
funcs.push_back(std::make_pair(std::string(), func));
std::vector<Const_Proxy_Function> funcs;
funcs.push_back(func);
return functor<FunctionType>(funcs);
}