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 4054088
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:31:48+00:00 2026-05-20T14:31:48+00:00

In one of my rules a have qi::locals<> with stl container as parameter. When

  • 0

In one of my rules a have qi::locals<> with stl container as parameter. When I compile my program without BOOST_SPIRIT_QI_DEBUG, everything works fine. But when I turn BOOST_SPIRIT_QI_DEBUG on, program can’t be compiled because of missing operator <<.

Simplified snippet:

typedef std::list< int > TlstValues;

template <typename Iterator, typename Skipper>
struct G_test : qi::grammar<Iterator, Skipper>
{
  ...
  G_test() : G_test::base_type(rule_test)
  {
    ...
    BOOST_SPIRIT_DEBUG_NODE(rule_test);
  }

  qi::rule<Iterator, qi::locals<TlstValues>, Skipper> rule_test;
}

error:

error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'TlstExpressionItems' (or there is no acceptable conversion)

I tried to define streaming operator for TlstValues but without effect. Error was still the same. My operator definition:

std::ostream& operator << (std::ostream& os, TlstValues & z)
{
return os;
} 

Can someone please advise me how to define required operator to make BOOST_SPIRIT_DEBUG work?

Thanks and regards
Rick

  • 1 1 Answer
  • 1 View
  • 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-20T14:31:48+00:00Added an answer on May 20, 2026 at 2:31 pm

    The simplest way to force ADL to find your streaming operator is to put it into the namespace std:

    namespace std
    {
        std::ostream& operator<< (std::ostream& os, TlstValues& z)
        {
            // do your stuff here
            return os;
        } 
    }
    

    Yes, I know, this is formally not allowed. However, from a pragmatic standpoint it’s still the easiest way.

    The Standards conformant solution is to specialize the Spirit customization point print_attribute_debug for your attribute type:

    // your specialization needs to be in namespace boost::spirit::traits
    namespace boost { namespace spirit { namespace traits
    {
        template <typename Out>
        struct print_attribute_debug<Out, TlstValues>
        {
            static void call(Out& out, TlstValues const& val)
            {
                // do your output here; Out is a std::ostream
            }
        };
    }}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of rewrite rules, but one of the rules is applying
this is a weird one. i have a -pre-compile target in my custom_rules.xml .
the task is quite simple, but i have not figured it out yet. one
Starting a new big C multiplatform project, what rules should one follow to avoid
Java Naming rules suggests which one to be used. This public static final class
Can any one explain how Java SimpleTimeZone rules are interpreted. For example a rule
We developed an asp.net website for one of our customer. We followed our rules
So there's the Do One Thing rule in the book Clean Code. But how
i am trying to modify one js file validation rule but unable to do
I have the following rewrite rules: #remove the www. RewriteCond %{HTTP_HOST} ^www.website.co.uk$ [NC] RewriteRule

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.