Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 27.02.2012 19:01, Michael Meeks wrote:
        Having said that I'm not hyper-happy with not initialising the vector's
contents - don't we really want:

        std::vector<sal_uInt16>  aWish( aTablCols.Count() + 1, 0 ),
                                aMins( aTabCols.Count() + 1, 0 );

Hmm, no...

From C++ standart (8.5, cl. 5):
To default-initialize an object of type T means:
— if T is a non-POD class type (clause 9), the default constructor for T is called (and the 
initialization is
ill-formed if T has no accessible default constructor);
— if T is an array type, each element is default-initialized;
— otherwise, the storage for the object is zero-initialized.

and vector has

explicit vector(size_type n, const T& value = T(), const Allocator& = Allocator());

so, there will be zeroes by default.

Regards,
Ivan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.