Boost logo

Boost :

Subject: Re: [boost] [lexical_cast] char types and UDTs
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-04-11 04:13:06


On Wed, Apr 11, 2012 at 8:54 AM, Eric Niebler <eric_at_[hidden]> wrote:
> Calling m.str() creates a temporary std::wstring object, which incurs a
> dynamic allocation and is slow. Speaking for my own library (xpressive),
> sub_match has an optimized stream insertion operator. It should be used.

You have to construct a string somewhere, don't you?
If you have one already, you could use iterator_range<const char*>
instead to avoid a copy.

> But my primary objection is below...

You're right, it'd be nice if that just worked.

-- 
Olaf

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk