[Libreoffice] [PATCH] Replace WW8Bytes with ww::bytes

Stephan Bergmann sbergman at redhat.com
Thu Oct 6 00:16:21 PDT 2011


On 10/05/2011 10:11 PM, Michael Stahl wrote:
> On 05.10.2011 22:02, Maciej Rumianowski wrote:
>> Dnia 2011-10-05, śro o godzinie 17:35 +0200, Lubos Lunak pisze:
>>> On Wednesday 05 of October 2011, Jan Holesovsky wrote:
>
>>>> That would allow you to convert the pO->GetData() to something like
>>>> po->data(), instead of&(*pO)[0] (and similar) used on many places...
>>>
>>>   That same would be allowed by
>>> class bytes : public std::vector<sal_uInt8>
>>> {
>>> public:
>>> const sal_uInt8* data() const { return&front(); }
>>> ...
>> So if it is desired solution I can modify Patches?
>
> why not just use "&po->front()" directly instead, that's nicer than
> &(*po)[0] and no need to introduce a class just for this IMHO.

&v[0] has become something of a standard idiom, I'd say.  So, personal 
taste mostly.

Btw, &v[0] (as well as &v.front()) are only valid if !v.empty() -- but 
(without checking it in detail right now) I guess the patch already 
takes account of that, Maciej?

-Stephan


More information about the LibreOffice mailing list