Things is that.
I want to create a wildcard struct that similar to Range and RangeBound.Range or RangeBound is useful,but something can not satisfy me.
I duplicate their frame and make some pruning. But there are something wrong at the Macro for compiling wildcard struct.
#define DEFINE_ATTRIBUTE_RANGE_BOUND_WRAPPER_STRUCT(Name, ElementType) \
USTRUCT(BlueprintType)\
struct Name : TAttributeRangeBound<ElementType> \
{ \
GENERATED_BODY()\
private: \
typedef TAttributeRangeBound<ElementType> Super; \
TEnumAsByte<EAttributeRangeBoundTypes::Type> Type;\
\
ElementType Value;\
\
public: \
Name() \
: Super() \
{ } \
\
Name(const Super& Other) \
: Super(Other) \
{ } \
\
Name(const ElementType InValue) \
: Super(InValue) \
{ } \
\
static FORCEINLINE Name Inclusive(ElementValueOrConstRef Value) \
{ \
return static_cast<const Name&>(Super::Inclusive(Value)); \
} \
\
static FORCEINLINE Name Open() \
{ \
return static_cast<const Name&>(Super::Open()); \
} \
\
static FORCEINLINE const Name& MaxLower(const Name& A, const Name& B) \
{ \
return static_cast<const Name&>(Super::MaxLower(A, B)); \
} \
\
static FORCEINLINE const Name& MaxUpper(const Name& A, const Name& B) \
{ \
return static_cast<const Name&>(Super::MaxUpper(A, B)); \
} \
\
static FORCEINLINE const Name& MinLower(const Name& A, const Name& B) \
{ \
return static_cast<const Name&>(Super::MinLower(A, B)); \
} \
\
static FORCEINLINE const Name& MinUpper(const Name& A, const Name& B) \
{ \
return static_cast<const Name&>(Super::MinUpper(A, B)); \
} \
}; \
\
template <> \
struct TIsBitwiseConstructible<Name, TAttributeRangeBound<ElementType>> \
{ \
enum { Value = true }; \
}; \
\
template <> \
struct TIsBitwiseConstructible<TAttributeRangeBound<ElementType>, Name> \
{ \
enum { Value = true }; \
};
DEFINE_ATTRIBUTE_RANGE_BOUND_WRAPPER_STRUCT(FDoubleAttributeRangeBound, double)
And,it is included “AttributeRangeBound.generated.h”
Build to show that “error C4430: Type specifier missing - int assumed. Note: C++ does not support default int”
When delete that "USTRUCT(BlueprintType)" and "GENERATED_BODY()", it can be builded,but the NewCreate struct FDoubleAttributeRangeBound can not be mark by UPROPERTY and can not be notice by reflecting system.
So,Any one can solve it? Thank very much!
AttributeRangeBound.h (8.6 KB)
AttributeRange.h (14.3 KB)