Mirro1871
(Mirro1871)
May 23, 2022, 11:03am
1
TArray <TQueue > test;
TQueue tempQueue;
tempQueue.Enqueue(1);
test.Add(tempQueue);
Severity
Code
Description
Project
File
Line
Suppression State
Error
C2280
‘TQueue<int,EQueueMode::Spsc>::TQueue(const TQueue<int,EQueueMode::Spsc> &)’: attempting to reference a deleted function
ITMSProject
C:\Program Files\UE_4.27\Engine\Source\Runtime\Core\Public\Containers\Array.h
1959
Error
C2248
‘TQueue<int,EQueueMode::Spsc>::TQueue’: cannot access private member declared in class ‘TQueue<int,EQueueMode::Spsc>’
ITMSProject
C:\Program Files\UE_4.27\Engine\Source\Runtime\Core\Public\Containers\Array.h
1959
zos
(Andrew Tomazos)
May 24, 2022, 1:07am
2
TQueue is non-copyable, so you can’t I don’t think:
TQueue::TQueue(const TQueue&) = delete;
zos
(Andrew Tomazos)
May 24, 2022, 1:09am
3
You could use std::vector<std::unique_ptr<TQueue>> instead. I’m not sure if TArray<std::unique_ptr> works, or what the std::unique_ptr equivalent is in unreal.
TSharedPtr<TQueue > * I can put it in the smart pointer
TArray<TSharedPtr<TQueue<int>>> test;
TSharedPtr<TQueue<int>> tempQueue(new TQueue<int>());
if (tempQueue.IsValid())
{
tempQueue.Get()->Enqueue(1);
}
test.Add(tempQueue);
Try that.