Boost logo

Boost :

Subject: Re: [boost] hex/unhex()?
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-11-01 16:29:29


On Nov 1, 2011, at 1:09 PM, Olaf van der Spek wrote:

> Does Boost have hex/unhex() that support std::string?
> I can't find them and I think they'd be quite handy to have.

I don't know of any. (I'm assuming that you're talking about the calls from MySQL - http://www.java2s.com/Tutorial/MySQL/0460__String-Functions/0920__UNHEX.htm)

I suspect, but haven't tried, that they would be one or two-liners in Boost.Spirit.

You want something like this?
        template <typename InputIterator, typename OutputIterator>
        OutputIterator hex ( InputIterator first, InputIterator last, OutputIterator out );

        template <typename InputIterator, typename OutputIterator>
        OutputIterator unhex ( InputIterator first, InputIterator last, OutputIterator out );

[ + range based versions ]
[ + versions that work on char/wchar_t/short/int/long/long long, etc]

-- 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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk