Boost logo

Boost Users :

Subject: Re: [Boost-users] commandline args
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2009-08-24 01:20:35


That also gave me compilation errors:

..\Dependency\boost\boost/spirit/home/karma/generate.hpp(72) : error
C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
from 'boost::mpl::failed ************(__thiscall
boost::spirit::karma::generate::error_invalid_expression::*
***********)(Expr)' to 'boost::mpl::assert<false>::type'

..\Dependency\boost\boost/spirit/home/karma/generate.hpp(76) : error
C2039: 'generate' : is not a member of
'boost::proto::exprns_::expr<Tag,Args,Arity>'

Below, please find a minimal example.
Thank you for your continued help!

Best,
Dee

---
#include <vector>
#include <string>
#include <iostream>
using namespace std;
#include <boost/spirit/include/karma.hpp>
namespace bk  = boost::spirit::karma;
namespace ba  = boost::spirit::ascii;
int main()
{
    vector<string> vsTest;
    vsTest.push_back("test");
    vsTest.push_back("t2");
    vsTest.push_back("t3");
    bk::generate(ostream_iterator<char>(cout),
        "Command line options not recognized:\n" <<
        ("  \"" << ba::string % ("\"" << bk::eol)) << "\"" << bk::eol,
        vsTest);
    bk::generate(ostream_iterator<char>(cout),
        "Command line options not recognized:\n" <<
        ('\"' << ba::string << '\"') % bk::eol << bk::eol,
        vsTest);
    return 0;
}
---
On Mon, Aug 24, 2009 at 1:01 PM, OvermindDL1<overminddl1_at_[hidden]> wrote:
> On Sun, Aug 23, 2009 at 10:42 PM, Diederick C.
> Niehorster<dcnieho_at_[hidden]> wrote:
>>> Er, do this I mean (adding spacing to help clarify things for you to):
>>> bk::generate(ostream_iterator<char>(cout),
>>>  "Command line options not recognized:\n" <<
>>>  ("  \"" << ba::string << '\"') % bk::eol
>>>  ,vsUnrecog);
>>>
>>> To describe it, it first prints out a string, then the % operator has
>>> two part, the left side ('\"' << ba::string << '\"'), and the right
>>> bk::eol, meaning that the left side is run for each element in a list
>>> separated by returns.
>>
>> Hi OvermindL1,
>>
>> That is indeed exactly what I'm looking for, please also see my reply
>> to your previous message.
>> I want to enclose every item in the list with quotes and print them on
>> separate lines.
>
> If that did not work, I am surprised, perhaps hartmut could see why,
> he is the expert here.  :)
>
> Try:
> bk::generate(ostream_iterator<char>(cout),
>  "Command line options not recognized:\n" <<
>  ("  \"" << ba::string << '\"') >> *("\n  \"" << ba::string << '\"')
>  ,vsUnrecog);
>
> More verbose, but it should do the same thing as the top one, see if
> it works, I am curious why the previous one did not know, I may have
> to try it myself...
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net