Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:52:30+00:00 2026-05-30T03:52:30+00:00

The accepted answer to this other question lead me to this sample, but compiling

  • 0

The accepted answer to this other question lead me to this sample, but compiling it give a long error list. Here the sample code, I added just the includes and a dummy main():

#include <boost/spirit/include/qi.hpp>
#include <vector>
#include <map>
#include <string>
#include <iostream>

namespace qi = boost::spirit::qi;

template <typename Iterator>
struct keys_and_values
  : qi::grammar<Iterator, std::map<std::string, std::string>()>
{
    keys_and_values()
      : keys_and_values::base_type(query)
    {
        query =  pair >> *((qi::lit(';') | '&') >> pair);
        pair  =  key >> -('=' >> value);
        key   =  qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9");
        value = +qi::char_("a-zA-Z_0-9");
    }
    qi::rule<Iterator, std::map<std::string, std::string>()> query;
    qi::rule<Iterator, std::pair<std::string, std::string>()> pair;
    qi::rule<Iterator, std::string()> key, value;
};

int main(int argc, char **argv)
{
    std::string input("key1=value1;key2;key3=value3");  // input to parse
    std::string::iterator begin = input.begin();
    std::string::iterator end = input.end();

    keys_and_values<std::string::iterator> p;    // create instance of parser
    std::map<std::string, std::string> m;        // map to receive results
    bool result = qi::parse(begin, end, p, m);   // returns true if successful
}

I’ve tried both boost 1.42 (default on my Ubuntu 11.04 distro), and 1.48 (downloaded). Errors (I report those filtered by QtCreator) differ: ver 1.42 gives

/usr/include/boost/fusion/support/tag_of.hpp:92:13: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::mpl::not_<boost::fusion::detail::is_specialized<std::pair<std::basic_string<char>, std::basic_string<char> > > >::************)’

/usr/include/boost/spirit/home/support/attributes.hpp:409: error: no matching function for call to ‘std::basic_string<char>::basic_string(std::pair<std::basic_string<char>, std::basic_string<char> >&)’

/usr/include/boost/spirit/home/support/attributes.hpp:409: error: no matching function for call to ‘std::basic_string<char>::basic_string(mpl_::void_&)’

while ver. 1.48 gives

/home/carlo/Projects/spirit_vect_literals-build-desktop/../../cpp/boost_1_48_0/boost/spirit/home/qi/detail/assign_to.hpp:123: error: no matching function for call to ‘std::pair<std::basic_string<char>, std::basic_string<char> >::pair(const std::basic_string<char>&)’

Do I have something missing?

edit: I’ve found the solution: add this header and both versions compile

#include <boost/fusion/adapted/std_pair.hpp>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:52:33+00:00Added an answer on May 30, 2026 at 3:52 am

    Congratulations on tracking this down… I hit the same error a few weeks back and wasted hours with it. As you found, the solution is just to include this:

    #include <boost/fusion/adapted/std_pair.hpp>
    

    which provides the necessary magic for Qi to use std::pair as the output of a rule.

    I’m mainly leaving this answer here just so the question no longer shows up as unanswered – if you want to add/accept your own answer I’ll retract this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is basically a duplicate of this question , but the accepted answer was
This question has been asked before but 1) the user never accepted an answer
This Question is similar but the accepted answer solves it server side, I'm interested
This question has been asked here before . The accepted answer was probably obvious
Based the accepted answer to this question I've setup a NetBeans/tomcat environment. In testing
I was reading over this question and wondered if the accepted answer might also
I just read this question and the accepted answer: What is JavaScript garbage collection?
Note : The accepted answer on the other question shows how to use the
This is related to the accepted answer for What’s your #1 way to be
The accepted answer to the question C++ Library for image recognition: images containing words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.