i wanna be able to create this macro in c++ but I cant find any doc regarding macros.
It depends on what exactly you’re trying to do. Do you want to write something in C++ as a replacement for that macro, but still for use in Blueprint? Do you want to recreate that functionality in C++ to use in C++? Do you want one thing that works in both?
i want to use it in c++. no blueprints
also whats the equvilent of wildcard in c++? can i use the variable type auto?
Sort of, but it’s all standard C++ that should plenty of documentation/tutorials. It’s not surprising you wouldn’t find any UE4 docs.
Option 1: a macro
#define Macro( NV, NT, PT ) ....
Option 2: templates
template <class T>
void Macro( const T &NewValue, T &NewTarget, T &PreviousTarget )
{
...
}
The template is probably the better option, but you’ll want to be sure you learn a bit more about that language feature.
in which class should i create this? object or none
I can’t really answer that, there’s no right answer.
You don’t have to include it in any class.
Or you could just stick in any header and include that header in the CPP files that you want to use it from.
Or you could add it to any class or namespace you want.
Neither the macro or template will be visible to the Engine, so go nuts.
guys i have another question.
what are these inputs? are they local variables?
also this is what I did in the code but I cant figure out those inputs
So normally those are function parameters, but in this case it’s slightly obscured by the assignment operator that your doing (which is basically a function with two parameters).
You got the first one right, so for the second one you’re just assigning to NewValue to New Target (NewTarget = NewValue).
You may want to do some general review of C++ if you’re going to keep going. I get the feeling you don’t really understand the language all that well.
there’s no point in learning native c++ cuz unreal header tool doesn’t fully support c++ as its.
in native c++ all u have to do is use the auto type so that it changes dynamically at run time but unreal doesn’t support that.
plus converting blueprints to c++ requires its own knowledge, I know some people that are god when it comes to programming but they are struggling to get anything done in ue4 cuz again stuff are limited by the header tool.
That’s very much untrue.
You clearly don’t understand C++. Auto is determined at compile time. Also, since auto isn’t used in headers it’s not really an issue. I use auto extensively in my UE4 project with no problems whatsoever.
That’s just bunk. Converting from blueprint to C++ does not require any special knowledge or skills.
Everyone I know that’s well versed in C++ has absolutely no problems. Yes, there are cases where Unreal puts a few more restrictions on what you can do with your header declarations but that’s such a small portion of the language. Even then it only matters when you’re dealing with a UFUNCTION or UPROPERTY. Of course there’s always going to be the problem that Unreal is a huge engine that can make it tough to use regardless of programming skill, but that’s got nothing to do with the language.