title: Using simple Boost::Spirit grammars?
body: <p>I couldn't get a grammar to work so I simplified it till it only parses an integer. Still can't get it to work. It is the following grammar:</p>
  
  <pre><code>template&lt;typename Iterator&gt;
  struct rangeGrammar : qi::grammar&lt;Iterator, int()&gt;
  {
      rangeGrammar() :
      rangeGrammar::base_type(number)
      {
          using qi::int_;
          using qi::_1;
          using qi::_val;
  
          number = int_[_val = _1];
      }
      qi::rule&lt;Iterator, int()&gt; number;
  };
  </code></pre>
  
  <p>It is supposed to just parse an integer (I know I could just tell the parse function to use int_ as the grammar, but I wan't to know what is wrong in this example). </p>
  
  <p>My parse function is:</p>
  
  <pre><code>/* n is a std::string provided by the user */
  rangeGrammar&lt;std::string::const_iterator&gt; grammar;
  int num = 0;
  qi::phrase_parse(n.start(), n.end(), grammar, num);
  std::cout &lt;&lt; "Number: " &lt;&lt; num &lt;&lt; std::endl;
  </code></pre>
  
  <p>I get the following compiler error:</p>
  
  <blockquote>
    <p>/boost/spirit/home/qi/reference.hpp: In member function ‘bool boost::spirit::qi::reference::parse(Iterator&amp;, const Iterator&amp;, Context&amp;, const Skipper&amp;, Attribute&amp;) const [with Iterator = __gnu_cxx::__normal_iterator >, Context = boost::spirit::context, boost::spirit::locals&lt;> >, Skipper = boost::spirit::unused_type, Attribute = int, Subject = const boost::spirit::qi::rule&lt;__gnu_cxx::__normal_iterator >, int(), boost::spirit::unused_type, boost::spirit::unused_type, boost::spirit::unused_type>]’:
    /boost/spirit/home/qi/parse.hpp:89:82:   instantiated from ‘bool boost::spirit::qi::parse(Iterator&amp;, Iterator, const Expr&amp;, Attr&amp;) [with Iterator = __gnu_cxx::__normal_iterator >, Expr = rangeGrammar&lt;__gnu_cxx::__normal_iterator > >, Attr = int]’
    ../parameter_parser.h:95:46:   instantiated from here
    boost/spirit/home/qi/reference.hpp:43:71: error: no matching function for call to ‘boost::spirit::qi::rule&lt;__gnu_cxx::__normal_iterator >, int(), boost::spirit::unused_type, boost::spirit::unused_type, boost::spirit::unused_type>::parse(__gnu_cxx::__normal_iterator >&amp;, const __gnu_cxx::__normal_iterator >&amp;, boost::spirit::context, boost::spirit::locals&lt;> >&amp;, const boost::spirit::unused_type&amp;, int&amp;) const’
    cc1plus: warnings being treated as errors
    /boost/spirit/home/qi/reference.hpp:44:9: error: control reaches end of non-void function
    <strong>* exit status 1 *</strong></p>
  </blockquote>
  
  <p>Can't figure out what the problem is. Any help would be greatly appreciated.</p>