Hello, there is the following class, with the following implementation:
template<typename Type> class List : public Memory::INonCopyable { struct Node { Type value; Node* next; Node* prev; }; public: explicit List(std::uint8_t countVirtualPages = 1) noexcept : mAllocator(countVirtualPages, sizeof(Node)) {} template<typename... Arguments> void emplaceFront(Arguments&&... arguments) noexcept; ... private: std::size_t mSize = 0; Node* mHead = nullptr; Node* mTail = nullptr; Memory::Allocators::PoolAllocator mAllocator; }; template<typename Type> template<typename... Arguments> void List<Type>::emplaceFront(Arguments&&... arguments) noexcept { void* memoryForNode = mAllocator.allocate(sizeof(Node)); Node* newNode = new (memoryForNode) Node((std::forward<Arguments>(arguments)...), mHead, nullptr); if (isEmpty()) { mHead = mTail = newNode; } else { mHead->prev = newNode; mHead = newNode; } }
When using the emplaceFront function, I get the following errors:
Error C2760 syntax error: unexpected token '...', expected ')' Error C3520 'arguments': parameter pack must be expanded in this context Error C2059 syntax error: '...'
How can this problem be solved?
Node{{std::forward<Arguments>(arguments)...}, mHead, nullptr}
- Croessmah pm