Skip to content

STL Vector needs void constructor #1613

@disinvite

Description

@disinvite

We use the STL vector in three places:

  • vector<undefined*> in LegoAnimActorStruct
  • vector<LegoAnimActorStruct*> in LegoAnimActor
  • vector<const ROI*> aka (ROIList) in ViewManager

In BETA10, there is a diff in the constructors for those three classes where we initialize the vector member:

0x10171cf5  -call <OFFSET3>
            +call RealtimeView::RealtimeView (FUNCTION)
0x10171cfa   mov byte ptr [ebp - 4], 1
0x10171cfe  -mov ecx, dword ptr [ebp - 0x18]
            +lea eax, [ebp - 0x10]
            +push eax
            +mov ecx, dword ptr [ebp - 0x14]
0x10171d01   add ecx, 0x18
0x10171d04  -call <OFFSET4>
            +call Vector<ROI const *>::Vector<ROI const *> (FUNCTION)

We're pushing a value into that function when we shouldn't be. It seems like we need a void constructor for Vector in mxstl.h, similar to the one for List:

template<class _TYPE>
class List : public list<_TYPE, allocator<_TYPE> >
{
public:
  typedef List<_TYPE> _Myt;
  typedef allocator<_TYPE> _A;

  explicit List() : list<_TYPE, _A>()
  {}

  explicit List(size_type _N, const _TYPE& _V = _TYPE()) : list<_TYPE, _A>(_N, _V)
  {}
//...

Imitating those two functions in Vector improves the accuracy for those three constructors, but introduces some diff noise as with most changes to a header.

Can any C++ experts speak to the correctness of that approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions