Move inline attribute inside struct

This commit is contained in:
Double Sine 2019-01-15 11:23:11 +08:00
parent 0ae8754462
commit baf4f45e65
No known key found for this signature in database
GPG Key ID: 44460E4F43EA8633
4 changed files with 10 additions and 42 deletions

View File

@ -86,27 +86,19 @@ public:
template<typename __ClassType>
struct CppObjectTraits {
using HandleType = __ClassType*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static inline void Releasor(HandleType pObject) {
delete pObject;
}
};
template<typename __ClassType>
inline const typename CppObjectTraits<__ClassType>::HandleType
CppObjectTraits<__ClassType>::InvalidValue = nullptr;
template<typename __ClassType>
struct CppDynamicArrayTraits {
using HandleType = __ClassType*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static inline void Releasor(HandleType pArray) {
delete[] pArray;
}
};
template<typename __ClassType>
inline const typename CppDynamicArrayTraits<__ClassType>::HandleType
CppDynamicArrayTraits<__ClassType>::InvalidValue = nullptr;

View File

@ -4,12 +4,9 @@
struct CapstoneHandleTraits {
using HandleType = csh;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = 0;
static inline void Releasor(csh Handle) {
cs_close(&Handle);
}
};
inline const CapstoneHandleTraits::HandleType
CapstoneHandleTraits::InvalidValue = 0;

View File

@ -6,37 +6,25 @@
struct OpensslBIOTraits {
using HandleType = BIO*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static constexpr auto& Releasor = BIO_free;
};
inline const OpensslBIOTraits::HandleType
OpensslBIOTraits::InvalidValue = nullptr;
struct OpensslBIOChainTraits {
using HandleType = BIO*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static constexpr auto& Releasor = BIO_free_all;
};
inline const OpensslBIOChainTraits::HandleType
OpensslBIOChainTraits::InvalidValue = nullptr;
struct OpensslBNTraits {
using HandleType = BIGNUM*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static constexpr auto& Releasor = BN_free;
};
inline const OpensslBNTraits::HandleType
OpensslBNTraits::InvalidValue = nullptr;
struct OpensslRSATraits {
using HandleType = RSA*;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = nullptr;
static constexpr auto& Releasor = RSA_free;
};
inline const OpensslRSATraits::HandleType
OpensslRSATraits::InvalidValue = nullptr;

View File

@ -4,28 +4,19 @@
struct GenericHandleTraits {
using HandleType = HANDLE;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = NULL;
static constexpr auto& Releasor = CloseHandle;
};
inline const GenericHandleTraits::HandleType
GenericHandleTraits::InvalidValue = NULL;
struct FileHandleTraits {
using HandleType = HANDLE;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = INVALID_HANDLE_VALUE;
static constexpr auto& Releasor = CloseHandle;
};
inline const FileHandleTraits::HandleType
FileHandleTraits::InvalidValue = INVALID_HANDLE_VALUE;
struct MapViewTraits {
using HandleType = PVOID;
static const HandleType InvalidValue;
static inline const HandleType InvalidValue = NULL;
static constexpr auto& Releasor = UnmapViewOfFile;
};
inline const MapViewTraits::HandleType
MapViewTraits::InvalidValue = NULL;