There are several ways to achieve this:
#include <boost/spirit/include/parse.hpp>
#include <boost/spirit/include/qi_numeric.hpp>
using namespace qi = boost::spirit::qi;
std::string s("123");
int result = 0;
qi::parse(s.begin(), s.end(), qi::int_, result);
or a shorter:
qi::parse(s.begin(), s.end(), result);
which is based on Spirit's auto
features. If you wrap one of these into a function, you get what you want.
EDIT: I saw only now that you're using Boost 1.34. So here is the corresponding incantation for this:
#include <boost/spirit.hpp>
using namespace boost::spirit;
std::string s("123");
int result = 0;
std::string::iterator b = s.begin();
parse(b, s.end(), int_p[assign_a(result)]);