[Boost-bugs] [Boost C++ Libraries] #6948: Boost::spirit::karma generator bug

Subject: [Boost-bugs] [Boost C++ Libraries] #6948: Boost::spirit::karma generator bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-28 01:58:23


#6948: Boost::spirit::karma generator bug
-----------------------------------+----------------------------------------
 Reporter: yaoyuan1216@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
-----------------------------------+----------------------------------------
 I wanna save a generator so that I can call it anytime without writing
 duplicate codes. Here is my code:

 #include<boost/spirit/include/karma.hpp>
 #include<boost/spirit/include/karma_format_attr.hpp>
 #include<list>
 #include<iostream>

 //auto par = '{' << -(boost::spirit::karma::int_ % ',') << '}';//This
 would lead error!
 int main(){
         using namespace std;
         namespace karma = boost::spirit::karma;
         list<int> l{1, 2, 4};
         auto par = '{' << -(boost::spirit::karma::int_ % ',') <<
 '}';//This would not!
         cout<<karma::format(par, l)<<endl;
         return 0;
 }

 When I define par out of a functint would leads to runtime error. Does I
 used it generator in a wrong way or it is a bug?
 GCC version 4.6.3

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6948>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC