|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-07-06 14:25:05
"Robert Ramey" <ramey_at_[hidden]> writes:
> Then I wanted to compose them with a typedef
>
> typedef
> boost::archive::iterators::insert_linebreaks<
> boost::archive::iterators::base64_from_binary<
> boost::archive::iterators::transform_width<
> const char *,
> 6,
> 8
> >
> >
> ,72
> ,const char // cwpro8 needs this
> >
> base64_text;
>
> Wow - just great. Now just construct an instance of base64_text - and we're
> in business. So I can do:
>
> char * address; // pointer to character buffer
> ...
> boost::archive::iterators::ostream_iterator<char> oi(os);
> std::copy(
> base64_text(address),
> base64_text(
> address + count
> ),
> oi
> );
>
> Uh - oh - I can do the above - because I need to instanciate the iterator
> with
> some sort of make_???_iterator. This an extra pain and adds a lot of
> confusion
> It also prevents me from doing something like:
>
> std::copy(
> wchar_from_mb(base64_text(address))),
> wchar_from_mb((base64_text(
> address + count
> )),
> oi
> );
>
> should I find this convenient.
>
> By adding the templated constructors and using them instead of
> make_???_functions
> I was able to achieve what I desired.
>
>>> I've never been able to convince anyone else
>>> of the merit of the approach - but hope springs eternal.
>>
>> Maybe you never articulated sufficiently clearly what you added to the
>> basics provided by the iterator library, and why.
>
> LOL - apparently so.
Thanks; I think I see why you need the templated ctors now.
w.r.t. composing with a typedef, would
boost::archive::iterators::insert_linebreaks<
boost::archive::iterators::base64_from_binary<
boost::archive::iterators::transform_width<
const char *,
6,
8
>::type
>::type
,72
,const char // cwpro8 needs this
>::type
base64_text;
be much worse, for your purposes?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk