I'm receiving this error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xmemory0:881: error: C2661: 'std::array<uint,3>::array': no overloaded function takes 3 arguments
At this line of code:
template<class _Objty,
class... _Types>
static void construct(_Alloc&, _Objty * const _Ptr, _Types&&... _Args)
{ // construct _Objty(_Types...) at _Ptr
::new (const_cast<void *>(static_cast<const volatile void *>(_Ptr)))
_Objty(_STD forward<_Types>(_Args)...); // ** Error is here
}
I'm using std::array<uint, 3>
like this:
void MyClass::myMethod(
// ...
, std::vector<std::array<uint, 3>> &indices
// ...
, const size_t ssteps
// ...
)
{
// ...
indices.reserve(2*ssteps);
auto steps = int(ssteps);
auto offs = steps;
auto last = steps - 1;
// ...
indices.emplace_back(0, last, offs);
indices.emplace_back(last, offs + last, offs);
// ...
}
I don't understand why this error is happening inside the xmemory0
included file. Any hint is appreciated.
As @kakkoko already pointed out:
Unfortunately, an additional pair of curly braces is not sufficient:
Output:
Live Demo on coliru
So, the elements have to be constructed explicitly:
Live Demo on coliru
or
std::vector::push_back()
has to be used instead:Live Demo on coliru
A complete demo:
Output:
Live Demo on coliru