Skip to content

Instantly share code, notes, and snippets.

@vgvgvvv
Created May 9, 2020 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgvgvvv/8ef8083b4b6735256fd4e1a427695ed9 to your computer and use it in GitHub Desktop.
Save vgvgvvv/8ef8083b4b6735256fd4e1a427695ed9 to your computer and use it in GitHub Desktop.
基于UE4的默认值模板
#pragma once
template<typename T>
class TDefaultValue
{
public:
static T value;
};
template<typename T>
T TDefaultValue<T>::value = T();
template<typename T>
class TDefaultValue<T&>
{
public:
static T value;
};
template<typename T>
T TDefaultValue<T&>::value = T();
template<typename T>
class TDefaultValue<T*>
{
public:
static T* value;
};
template<typename T>
T* TDefaultValue<T*>::value = nullptr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment