Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-01-19 22:39:08


At Wed, 19 Jan 2011 21:44:44 -0500,
Chad Nelson wrote:
>
> On Wed, 19 Jan 2011 14:32:31 -0800
> Mostafa <mostafa_working_away_at_[hidden]> wrote:
>
> >> operator* has a long history of providing the contents of a variable,
> >> even in C, and is a lot less typing to boot. But if you have any
> >> technical arguments against it, I'm listening.
> >
> > Can we stick to std::string conventions as closely as possible? It
> > makes using whatever new string library that much easier, and clearer,
> > and maintainable.
>
> Is there a conventional way to get the data stored in an std::string? ;-)

  s.data()

see std::vector (in C++0x at least, if not before).

> > From usage, it's not readily apparent what operator* is supposed to
> > do in the context of strings, ie,
> >
> > utf8_t myStr(...);
> > some_api_foo(*myStr);
> >
> > Even if I'm an experienced programmer, but a newbie to whatever
> > library makes use of some_api_foo, I would be scratching my head at
> > "*myStr"; and I would be forced to look up utf8_t::operator* or
> > some_api_foo to figure it out.

+1

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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