Boost logo

Boost :

Subject: Re: [boost] hex/unhex()?
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-11-02 17:31:05

On Nov 2, 2011, at 1:32 PM, michi7x7 wrote:

> Hi,
>>>> As Marshal pointed out, Spirit supports that easily

There are two 'll's at the end of my name, actually ;-)

>> Actually, please disregard what I wrote, it is complete nonsense. I misread
>> your initial mail.
>> Note to self: drink coffee before responding to email!
>> Regards Hartmut
> Actually, it's not really difficult.


I made it more general:

   template<class InputIterator, typename OutputIterator>
   OutputIterator hex ( InputIterator first, InputIterator last, OutputIterator out )
       for ( ; first != last; ++first )
           boost::spirit::karma::generate (out, boost::spirit::karma::hex, *first);
       return out;

The problem with this is that if you pass it a sequence of wchar_t (say, from a wasting), it only encodes two hex digits per "character".

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki

Boost list run by bdawes at, gregod at, cpdaniel at, john at