Hi!
Creating a TTuple in the brackets of a container add method does not compile.
However storing the created tuple in a temporary variable does work.
auto cont = TArray<TTuple<float,int>>();
cont.Add(TTuple<float,int>(1.0f,0));//Does not compile
auto val = TTuple<float,int>(1.0f,0);//Does compile
cont.Add(val);//Does compile
So my question is:
Am I just stupid and there is a way to do that in a single step?
Or might this be a problem with the TTuple implementation?
This is because the compiler is trying to instantiate TTuple’s variadic constructor as a move constructor. You’ll notice that the constructor of TFunction has a similar workaround.
I’ve got a local fix for this, which I shall commit after some testing, but I should say that TTuple isn’t quite yet a ‘first class citizen’ of UE4 because it is not supported on all of our compilers. It’s only currently intended as an implementation detail of delegate as implemented by variadic templates. When we no longer support compilers without variadics (which is basically Visual C++ 2012), TTuple will likely become a general utility class usable by anyone, and these kinds of bugs will get ironed out.