TArray of const elements (TIsBitwiseConstructible error)

Hi guys, I’ve got a problem with dynamic TArrays filled with const FCatalogueDBItem structs. There is struct definition:

// Raw c++ struct of db items
struct FCatalogueDBItem
{
	// Available constructors
	FCatalogueDBItem(const TScriptInterfacet<ICatalogueItem> InItem);
	FCatalogueDBItem(const TScriptInterfacet<ICatalogueItem> InItem, FCatalogueTabInfo InCategory);
	FCatalogueDBItem(const TScriptInterfacet<ICatalogueItem> InItem, FCatalogueTabInfo InCategory, FCatalogueTabInfo InSubcategory);
	
	// Members
	const TScriptInterfacet<ICatalogueItem> Item;
	FCatalogueTabInfo Category;
	FCatalogueTabInfo Subcategory;
	
	uint8 bHasCat:1;
	uint8 bHasSub:1;

	// Overloaded operators: == (const/non-const)
}

// Raw c++ struct of tab info
struct FCatalogueTabInfo
{
	// Available constructors
	FCatalogueTabInfo();
	FCatalogueTabInfo(FText InText, uint8 InFontSize = 0, UTexture2D* InIcon = nullptr);
	
	//Members
	FText Text;
	uint8 FontSize;
	TWeakObjectPtr<UTexture2D> Icon;
	
	// Overloaded operators: == (const/non-const), != (const/non-const)
}

Everytime i tries to compile it, this error occurs:

> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(258): error C2752: 'TIsBitwiseConstructible<const FCatalogueDBItem,const FCatalogueDBItem>': more than one partial specialization matches the template argument list
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(258): note: could be 'TIsBitwiseConstructible<T,T>'
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(258): note: or       'TIsBitwiseConstructible<const T,U>'
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(480): note: see reference to class template instantiation 'UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes<TArray<const FCatalogueDBItem,FDefaultAllocator>,TArray<const FCatalogueDBItem,FDefaultAllocator>>' being compiled
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(433): note: while compiling class template member function 'TEnableIf<!UE4Array_Private::TCanMoveTArrayPointersBetweenArrayTypes<FromArrayType,ToArrayType>::Value,void>::Type TArray<const FCatalogueDBItem,FDefaultAllocator>::MoveOrCopy(ToArrayType &,FromArrayType &,int32)'
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(478): note: while compiling class template member function 'TArray<const FCatalogueDBItem,FDefaultAllocator>::TArray(TArray<const FCatalogueDBItem,FDefaultAllocator> &&)'
> D:\WorkSpaces\----\----\Source\----\Private\Catalogue\Management\Bases\CatalogueBehaviourBase.cpp(131): note: see reference to function template instantiation 'TArray<const FCatalogueDBItem,FDefaultAllocator>::TArray(TArray<const FCatalogueDBItem,FDefaultAllocator> &&)' being compiled
> D:\WorkSpaces\----\----\Source\----\Private\Catalogue\LibraryBehaviour.cpp(14): note: see reference to class template instantiation 'TArray<const FCatalogueDBItem,FDefaultAllocator>' being compiled
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Templates/UnrealTypeTraits.h(449): error C2338: TIsBitwiseConstructible is not designed to accept qualified types
> D:\WorkSpaces\----\Engine\Source\Runtime\Core\Public\Containers/Array.h(258): note: see reference to class template instantiation 'TIsBitwiseConstructible<const FCatalogueDBItem,const FCatalogueDBItem>' being compiled

Everything i just did:

  1. Locally declare TArray of const structs
  2. Reserve size of TArray
  3. Fills it with const data items
  4. Precached it somewhere (non-const copy)
  5. Delete it from cache and returns them back (as const) to object (class) which created it

Can you show the part where you setup the array?

I’m getting this same issue when trying to return a TArray from a method. This isn’t supposed to be Blueprint-Visible so I assumed it would be fine.