Permutation Parser to vector<bool>, via matches <p>I have the following rule, inside my boost::spirit grammar;</p> <pre><code>rule = (qi::token(ABSTRACT) ^ qi::token(STATIC) ^ qi::token(FINAL)) </code></pre> <p>This construct has the type of;</p> <pre><code>boost::fusion::vector3&lt;boost::optional&lt;boost::iterator_range&lt;std::string::iterator&gt;&gt;, boost::optional&lt;boost::iterator_range&lt;std::string::iterator&gt;&gt;, boost::optional&lt;boost::iterator_range&lt;std::string::iterator&gt;&gt;&gt; </code></pre> <p>However, what I would rather have is;</p> <pre><code>boost::fusion::vector3&lt;bool, bool, bool&gt; </code></pre> <p>Where each <code>bool</code> have the value of the corresponding <code>boost::optional&lt;...&gt; operator bool() const</code>, with a single case, I'd use <code>qi::matches</code>, as suggested <a href="http://stackoverflow.com/questions/18705954/boostoptional-to-bool-inside-boostspiritqi-grammar/">here</a>. However applying this approach yields;</p> <pre><code>(qi::matches[qi::raw_token(ABSTRACT)] ^ qi::matches[qi::raw_token(STATIC)] ^ qi::matches[qi::raw_token(FINAL)]) </code></pre> <p>Which has the type;</p> <pre><code>boost::fusion::vector3&lt;boost::optional&lt;bool&gt;, boost::optional&lt;bool&gt;, boost::optional&lt;bool&gt;&gt; </code></pre> <p>Which is indeed not what I wanted, so how would I go about, matching these three tokens in random order, and getting whether they were matched as booleans?</p>