Inch by inch, getting closer to working out what the parser needs

This commit is contained in:
Jonathan Turner
2009-05-27 17:42:54 +00:00
parent 3dfe1fb8bd
commit 421a616924
5 changed files with 59 additions and 41 deletions

View File

@@ -27,14 +27,14 @@ boost::function<boost::shared_ptr<Class> ()> build_constructor()
# endif
#else
# define n BOOST_PP_ITERATION()
template<typename Class, BOOST_PP_ENUM_PARAMS(n, typename Param) >
boost::shared_ptr<Class> constructor( BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p) )
{
return boost::shared_ptr<Class>(new Class( BOOST_PP_ENUM_PARAMS(n, p) ));
}
template<typename Class, BOOST_PP_ENUM_PARAMS(n, typename Param) >
boost::function<boost::shared_ptr<Class> (BOOST_PP_ENUM_PARAMS(n, Param))> build_constructor()
{

View File

@@ -40,7 +40,7 @@ struct Test
double md;
};
void print_out(const std::string &s)
void print(const std::string &s)
{
std::cout << "Printed: " << s << std::endl;
}
@@ -68,8 +68,7 @@ int main()
//Register a new function, this one with typing for us, so we don't have to ubox anything
//right here
//JDT: Was giving me compiler errors (not sure why)
ss.register_function(boost::function<void (const std::string &)>(&print_out), "print");
ss.register_function(boost::function<void (const std::string &)>(&print), "print");
//Now we have a print method, let's try to print out the earlier example:
//so, we dispatch the to_string and pass its result as a param to "print"