Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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(FText InText, uint8 InFontSize = 0, UTexture2D* InIcon = nullptr);
     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

Product Version: Not Selected
more ▼

asked Mar 01 '19 at 01:35 PM in C++ Programming

avatar image

6 1

avatar image madturtleGGinin Mar 02 '19 at 02:45 PM

Can you show the part where you setup the array?

avatar image james.maiden Mar 22 '19 at 02:52 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question