visual studio 2010 - Does std::array call default ctors? -


i have class containing std::array of qvariant:

    class myclass()     {         typedef std::array<qvariant, 42> attribs_t;         attribs_t                        m_attribs;      public:         myclass()         {             m_attribs[0] = 41;         }     }; 

i analyzed project using intel parallel inspector , detects
"uninitialized memory access" @ m_attribs[0] = 41;

do have call constructor of elements in std::array manually or false positive?

the size of std::array array fixed @ compile-time, , default constructor (which myclass constructor invokes) default-constructs or copy-constructs every qvariant of array. i.e. i'd expect @ beginning of constructor, there 42 qvariant objects in array , invalid (i.e. isvalid() returns false).

the assignment should have same effect as

m_attribs[0] = qvariant( 41 ); 

which seems okay me.

in short: i'd tend claim it's false positive if wasn't intel's reputation. :-}


Comments