Boost logo

Boost Users :

Subject: Re: [Boost-users] commandline args
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2009-08-24 08:43:07


> Thank you for the suggestion.
>
> bk::generate(ostream_iterator<char>(cout), "Command line options not
> recognized:\n" << ('\"' << ba::string << '\"') % bk::eol << bk::eol,
> vsUnrecog);
>
> however gets me four compiler errors:

What version are you using? Unfortunately, the versions currently distributed with Boost (that's Spirit V2) is more like a beta as it has some bugs and isn't feature complete (that's why we didn't put it in the front row, keeping Spirit.Classic as the main version to use). OTOH, the code in Boost SVN trunk (that's V2.1) is really very stable and has matured a lot. If you want to experiment with Karma this is definitely the version to use. The expressions described by OvermindDL1 should work, so I suspect you're trying to make it working using the outdated code...

HTH
Regards Hartmut

>
> ..\Dependency\boost\boost/spirit/home/karma/string/lit.hpp(94) : error
> C2784: 'bool
> boost::spirit::karma::detail::string_generate(OutputIterator
> &,const Char *,CharEncoding,Tag)' : could not deduce template argument
> for 'const Char *' from 'const boost::iterator_range<IteratorT>'
>
> ..\Dependency\boost\boost/spirit/home/karma/string/lit.hpp(94) : error
> C2784: 'bool
> boost::spirit::karma::detail::string_generate(OutputIterator
> &,const std::basic_string<Char,Traits,Allocator> &,CharEncoding,Tag)'
> : could not deduce template argument for 'const
> std::basic_string<Char,Traits,Allocator> &' from 'const
> boost::iterator_range<IteratorT>'
>
> ..\Dependency\boost\boost/spirit/home/karma/string/lit.hpp(94) : error
> C2780: 'bool
> boost::spirit::karma::detail::string_generate(OutputIterator
> &,const std::basic_string<Char,Traits,Allocator> &)' : expects 2
> arguments - 4 provided
>
> ..\Dependency\boost\boost/spirit/home/karma/string/lit.hpp(94) : error
> C2780: 'bool
> boost::spirit::karma::detail::string_generate(OutputIterator
> &,const Char *)' : expects 2 arguments - 4 provided
>
> Best,
> Diederick
>
> On Mon, Aug 24, 2009 at 12:21 PM, OvermindDL1<overminddl1_at_[hidden]>
> wrote:
> > On Sun, Aug 23, 2009 at 10:03 PM, Diederick C.
> > Niehorster<dcnieho_at_[hidden]> wrote:
> >> Hi Harmut,
> >>
> >> Thank you for the answers. However, I am still having some trouble
> and
> >> i figure it out following the documentation on the list operator.
> >>
> >> I am trying to produce an output like below:
> >> Options not recognized:
> >> "dd"
> >> "-e"
> >> "rrty"
> >>
> >> However,
> >> bk::generate(ostream_iterator<char>(cout), "Command line options not
> >> recognized:\n" << (" \"" << ba::string % "\"" << bk::eol) <<
> bk::eol,
> >> vsUnrecog);
> >>
> >> does not do the trick and
> >>
> >> bk::generate(ostream_iterator<char>(cout), "Command line options not
> >> recognized:\n" << (" \"" % ba::string % "\"" << bk::eol) <<
> bk::eol,
> >> vsUnrecog);
> >>
> >> fails with
> "..\Dependency\boost\boost/spirit/home/karma/string/lit.hpp(108)
> >> : error C2664: 'boost::mpl::assertion_failed' : cannot convert
> >> parameter 1 from 'boost::mpl::failed ************(__thiscall
> >>
> boost::spirit::karma::any_string<CharEncoding,Tag>::generate::string_no
> t_usable_without_attribute::*
> >> ***********)(void)' to 'boost::mpl::assert<false>::type'" (which I
> >> guess is not the way it should fail? Shouldnt there be a nice
> >> assertion message or is this it? no experience with it really)
> >>
> >> What am I missing here?
> >
> > Maybe try this:
> > bk::generate(ostream_iterator<char>(cout), "Command line options not
> > recognized:\n" << ('\"' << ba::string << '\"') % bk::eol) << bk::eol,
> > vsUnrecog);
> >
> > You were doing a list of a list of a literal in such a way that
> cannot
> > be done, cannot take a list of a literal. :p
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> _______________________________________________
> 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