General: Remove unnecessary typename specifiers

This commit is contained in:
Lioncash 2019-08-15 09:41:30 -04:00
parent 919a74c72c
commit 5657bd7f2f
7 changed files with 157 additions and 175 deletions

View File

@ -56,7 +56,7 @@ constexpr PropId operator"" _propid(const char* s, size_t len) { return {s}; }
enum class PropType { None, CRC32, CRC64 };
template <class T>
using __IsPODType = typename std::disjunction<
using __IsPODType = std::disjunction<
std::is_arithmetic<std::remove_cv_t<T>>, std::is_convertible<std::remove_cv_t<T>&, atVec2f&>,
std::is_convertible<std::remove_cv_t<T>&, atVec3f&>, std::is_convertible<std::remove_cv_t<T>&, atVec4f&>,
std::is_convertible<std::remove_cv_t<T>&, atVec2d&>, std::is_convertible<std::remove_cv_t<T>&, atVec3d&>,
@ -65,7 +65,7 @@ template <class T>
constexpr bool __IsPODType_v = __IsPODType<T>::value;
template <class T>
using __CastPODType = typename std::conditional_t<
using __CastPODType = std::conditional_t<
std::is_convertible_v<std::remove_cv_t<T>&, atVec2f&>, atVec2f,
std::conditional_t<
std::is_convertible_v<std::remove_cv_t<T>&, atVec3f&>, atVec3f,
@ -112,7 +112,7 @@ struct BinarySize {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = size_t;
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& s) {
static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& s) {
if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */
s += 6;
@ -121,7 +121,7 @@ struct BinarySize {
BinarySize<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), s);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& s) {
static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& s) {
if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */
s += 6;
@ -130,19 +130,17 @@ struct BinarySize {
BinarySize<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), s);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& s) {
static std::enable_if_t<__IsDNARecord_v<T> && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& s) {
/* Accessed via Enumerate, header */
s += 6;
var.template Enumerate<BinarySize<PropOp>>(s);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& s) {
static std::enable_if_t<__IsDNARecord_v<T> && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& s) {
var.template Enumerate<BinarySize<PropType::None>>(s);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var)
BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
}
@ -151,14 +149,14 @@ struct BinarySize {
BinarySize<PropOp>::Do<T, DNAE>(id, var, s);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector,
const S& count, StreamT& s) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) {
for (T& v : vector)
BinarySize<PropOp>::Do<T, DNAE>(id, v, s);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& s) {
/* libc++ specializes vector<bool> as a bitstream */
s += vector.size();
}
@ -167,7 +165,7 @@ struct BinarySize {
s += count;
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
s += str.size() + 1;
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& s) {
@ -177,7 +175,7 @@ struct BinarySize {
s += count;
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
s += str.size() * 2 + 2;
}
template <Endian DNAE>
@ -263,7 +261,7 @@ struct PropCount {
s += 1;
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& s) {
/* Only reports one level of properties */
s += 1;
}
@ -272,7 +270,7 @@ struct PropCount {
s += 1;
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& s) {
/* Only reports one level of properties */
s += 1;
}
@ -290,23 +288,21 @@ struct Read {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamReader;
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using PODType = std::underlying_type_t<T>;
Read<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using CastT = __CastPODType<T>;
Read<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& r) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& r) {
var.template Enumerate<Read<PropType::None>>(r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& r) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& r) {
/* Accessed via Lookup, no header */
atUint16 propCount = __Read16<T::DNAEndian>(r);
for (atUint32 i = 0; i < propCount; ++i) {
@ -324,7 +320,7 @@ struct Read {
}
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var)
Read<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
}
@ -333,8 +329,8 @@ struct Read {
Read<PropOp>::Do<T, DNAE>(id, var, s);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector,
const S& count, StreamT& r) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
@ -343,8 +339,8 @@ struct Read {
}
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */
vector.clear();
vector.reserve(count);
@ -356,12 +352,12 @@ struct Read {
r.readUBytesToBuf(buf.get(), count);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readString();
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(count); }
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
Read<PropType::None>::Do<DNAE>(id, str, r);
}
template <Endian DNAE>
@ -429,7 +425,7 @@ struct Write {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = IStreamWriter;
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64)
@ -444,7 +440,7 @@ struct Write {
Write<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using CastT = __CastPODType<T>;
if (PropOp != PropType::None) {
/* Accessed via Enumerate, header */
@ -460,8 +456,7 @@ struct Write {
Write<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var,
StreamT& w) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp != PropType::None> Do(const PropId& id, T& var, StreamT& w) {
/* Accessed via Enumerate, header */
if (PropOp == PropType::CRC64)
__Write64<T::DNAEndian>(w, id.crc64);
@ -477,12 +472,11 @@ struct Write {
var.template Enumerate<Write<PropOp>>(w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var,
StreamT& w) {
static std::enable_if_t<__IsDNARecord<T>() && PropOp == PropType::None> Do(const PropId& id, T& var, StreamT& w) {
var.template Enumerate<Write<PropType::None>>(w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
for (auto& v : var)
Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
}
@ -491,14 +485,14 @@ struct Write {
Write<PropOp>::Do<T, DNAE>(id, var, s);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector,
const S& count, StreamT& w) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
for (T& v : vector)
Write<PropOp>::Do<T, DNAE>(id, v, w);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
for (const T& v : vector)
w.writeBool(v);
@ -508,13 +502,12 @@ struct Write {
w.writeUBytes(buf.get(), count);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, std::string& str, StreamT& w) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, std::string& str, StreamT& w) {
w.writeString(str);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(str, count); }
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, std::wstring& str,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, std::wstring& str, StreamT& w) {
Write<PropType::None>::Do<DNAE>(id, str, w);
}
template <Endian DNAE>
@ -580,22 +573,22 @@ struct ReadYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocReader;
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using PODType = std::underlying_type_t<T>;
ReadYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& r) {
using CastT = __CastPODType<T>;
ReadYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(var), r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& r) {
if (auto rec = r.enterSubRecord(id.name))
var.template Enumerate<ReadYaml<PropOp>>(r);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
size_t _count;
if (auto __v = r.enterSubVector(id.name, _count))
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i)
@ -606,8 +599,8 @@ struct ReadYaml {
/* Squelch size field access */
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector,
const S& count, StreamT& r) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
size_t _count;
vector.clear();
if (auto __v = r.enterSubVector(id.name, _count)) {
@ -621,8 +614,8 @@ struct ReadYaml {
const_cast<S&>(count) = vector.size();
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& r) {
/* libc++ specializes vector<bool> as a bitstream */
size_t _count;
vector.clear();
@ -638,12 +631,12 @@ struct ReadYaml {
buf = r.readUBytes(id.name);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readString(id.name);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& r) { str = r.readString(id.name); }
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& r) {
str = r.readWString(id.name);
}
template <Endian DNAE>
@ -697,22 +690,22 @@ struct WriteYaml {
using PropT = std::conditional_t<PropOp == PropType::CRC64, uint64_t, uint32_t>;
using StreamT = YAMLDocWriter;
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<std::is_enum_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using PODType = std::underlying_type_t<T>;
WriteYaml<PropType::None>::Do<PODType, DNAE>(id, *reinterpret_cast<PODType*>(&var), w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<__IsPODType_v<T>> Do(const PropId& id, T& var, StreamT& w) {
using CastT = __CastPODType<T>;
WriteYaml<PropType::None>::Do<CastT, DNAE>(id, static_cast<CastT&>(const_cast<std::remove_cv_t<T>&>(var)), w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<__IsDNARecord_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (auto rec = w.enterSubRecord(id.name))
var.template Enumerate<WriteYaml<PropOp>>(w);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) {
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) {
if (auto __v = w.enterSubVector(id.name))
for (auto& v : var)
WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
@ -722,15 +715,15 @@ struct WriteYaml {
/* Squelch size field access */
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector,
const S& count, StreamT& w) {
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
if (auto __v = w.enterSubVector(id.name))
for (T& v : vector)
WriteYaml<PropOp>::Do<T, DNAE>(id, v, w);
}
template <class T, class S, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
if (auto __v = w.enterSubVector(id.name))
for (const T& v : vector)
@ -740,12 +733,12 @@ struct WriteYaml {
w.writeUBytes(id.name, buf, count);
}
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& w) {
static std::enable_if_t<std::is_same_v<T, std::string>> Do(const PropId& id, T& str, StreamT& w) {
w.writeString(id.name, str);
}
static void Do(const PropId& id, std::string& str, atInt32 count, StreamT& w) { w.writeString(id.name, str); }
template <class T, Endian DNAE>
static typename std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& w) {
static std::enable_if_t<std::is_same_v<T, std::wstring>> Do(const PropId& id, T& str, StreamT& w) {
w.writeWString(id.name, str);
}
template <Endian DNAE>

View File

@ -9,12 +9,12 @@
namespace athena::io {
template <class T>
const char* __GetDNAName(const T& dna, typename std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = 0) {
const char* __GetDNAName(const T& dna, std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
return dna.DNATypeV();
}
template <class T>
const char* __GetDNAName(const T& dna, typename std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = 0) {
const char* __GetDNAName(const T& dna, std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
return dna.DNAType();
}

View File

@ -134,14 +134,13 @@ template <Endian DNAE>
struct DNAV;
template <class T>
using __IsDNARecord =
typename std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
using __IsDNARecord = std::disjunction<std::is_base_of<DNA<Endian::Big>, T>, std::is_base_of<DNA<Endian::Little>, T>>;
template <class T>
constexpr bool __IsDNARecord_v = __IsDNARecord<T>::value;
template <class T>
using __IsDNAVRecord =
typename std::disjunction<std::is_base_of<DNAV<Endian::Big>, T>, std::is_base_of<DNAV<Endian::Little>, T>>;
std::disjunction<std::is_base_of<DNAV<Endian::Big>, T>, std::is_base_of<DNAV<Endian::Little>, T>>;
template <class T>
constexpr bool __IsDNAVRecord_v = __IsDNAVRecord<T>::value;
} // namespace io

View File

@ -68,15 +68,15 @@ public:
return val;
}
template <class T>
atInt8 readVal(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) {
atInt8 readVal(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte();
}
template <class T>
atInt8 readValLittle(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) {
atInt8 readValLittle(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte();
}
template <class T>
atInt8 readValBig(typename std::enable_if<std::is_same<T, atInt8>::value>::type* = 0) {
atInt8 readValBig(std::enable_if_t<std::is_same_v<T, atInt8>>* = nullptr) {
return readByte();
}
@ -86,15 +86,15 @@ public:
*/
atUint8 readUByte() { return readByte(); }
template <class T>
atUint8 readVal(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) {
atUint8 readVal(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte();
}
template <class T>
atUint8 readValLittle(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) {
atUint8 readValLittle(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte();
}
template <class T>
atUint8 readValBig(typename std::enable_if<std::is_same<T, atUint8>::value>::type* = 0) {
atUint8 readValBig(std::enable_if_t<std::is_same_v<T, atUint8>>* = nullptr) {
return readUByte();
}
@ -144,7 +144,7 @@ public:
return m_endian == Big ? utility::BigInt16(val) : utility::LittleInt16(val);
}
template <class T>
atInt16 readVal(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) {
atInt16 readVal(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16();
}
@ -159,7 +159,7 @@ public:
return utility::LittleInt16(val);
}
template <class T>
atInt16 readValLittle(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) {
atInt16 readValLittle(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16Little();
}
@ -174,7 +174,7 @@ public:
return utility::BigInt16(val);
}
template <class T>
atInt16 readValBig(typename std::enable_if<std::is_same<T, atInt16>::value>::type* = 0) {
atInt16 readValBig(std::enable_if_t<std::is_same_v<T, atInt16>>* = nullptr) {
return readInt16Big();
}
@ -185,7 +185,7 @@ public:
*/
atUint16 readUint16() { return readInt16(); }
template <class T>
atUint16 readVal(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) {
atUint16 readVal(std::enable_if_t<std::is_same_v<T, atUint16>>* = 0) {
return readUint16();
}
@ -200,7 +200,7 @@ public:
return utility::LittleUint16(val);
}
template <class T>
atUint16 readValLittle(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) {
atUint16 readValLittle(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
return readUint16Little();
}
@ -215,7 +215,7 @@ public:
return utility::BigUint16(val);
}
template <class T>
atUint16 readValBig(typename std::enable_if<std::is_same<T, atUint16>::value>::type* = 0) {
atUint16 readValBig(std::enable_if_t<std::is_same_v<T, atUint16>>* = nullptr) {
return readUint16Big();
}
@ -230,7 +230,7 @@ public:
return m_endian == Big ? utility::BigInt32(val) : utility::LittleInt32(val);
}
template <class T>
atInt32 readVal(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) {
atInt32 readVal(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32();
}
@ -245,7 +245,7 @@ public:
return utility::LittleInt32(val);
}
template <class T>
atInt32 readValLittle(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) {
atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32Little();
}
@ -260,7 +260,7 @@ public:
return utility::BigInt32(val);
}
template <class T>
atInt32 readValBig(typename std::enable_if<std::is_same<T, atInt32>::value>::type* = 0) {
atInt32 readValBig(std::enable_if_t<std::is_same_v<T, atInt32>>* = nullptr) {
return readInt32Big();
}
@ -271,7 +271,7 @@ public:
*/
atUint32 readUint32() { return readInt32(); }
template <class T>
atUint32 readVal(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) {
atUint32 readVal(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32();
}
@ -286,7 +286,7 @@ public:
return utility::LittleUint32(val);
}
template <class T>
atInt32 readValLittle(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) {
atInt32 readValLittle(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32Little();
}
@ -301,7 +301,7 @@ public:
return utility::BigUint32(val);
}
template <class T>
atUint32 readValBig(typename std::enable_if<std::is_same<T, atUint32>::value>::type* = 0) {
atUint32 readValBig(std::enable_if_t<std::is_same_v<T, atUint32>>* = nullptr) {
return readUint32Big();
}
@ -316,7 +316,7 @@ public:
return m_endian == Big ? utility::BigInt64(val) : utility::LittleInt64(val);
}
template <class T>
atInt64 readVal(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) {
atInt64 readVal(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64();
}
@ -331,7 +331,7 @@ public:
return utility::LittleInt64(val);
}
template <class T>
atInt64 readValLittle(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) {
atInt64 readValLittle(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64Little();
}
@ -346,7 +346,7 @@ public:
return utility::BigInt64(val);
}
template <class T>
atInt64 readValBig(typename std::enable_if<std::is_same<T, atInt64>::value>::type* = 0) {
atInt64 readValBig(std::enable_if_t<std::is_same_v<T, atInt64>>* = nullptr) {
return readInt64Big();
}
@ -357,7 +357,7 @@ public:
*/
atUint64 readUint64() { return readInt64(); }
template <class T>
atUint64 readVal(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) {
atUint64 readVal(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64();
}
@ -372,7 +372,7 @@ public:
return utility::LittleUint64(val);
}
template <class T>
atUint64 readValLittle(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) {
atUint64 readValLittle(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64Little();
}
@ -387,7 +387,7 @@ public:
return utility::BigUint64(val);
}
template <class T>
atUint64 readValBig(typename std::enable_if<std::is_same<T, atUint64>::value>::type* = 0) {
atUint64 readValBig(std::enable_if_t<std::is_same_v<T, atUint64>>* = nullptr) {
return readUint64Big();
}
@ -402,7 +402,7 @@ public:
return m_endian == Big ? utility::BigFloat(val) : utility::LittleFloat(val);
}
template <class T>
float readVal(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) {
float readVal(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloat();
}
@ -417,7 +417,7 @@ public:
return utility::LittleFloat(val);
}
template <class T>
float readValLittle(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) {
float readValLittle(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloatLittle();
}
@ -432,7 +432,7 @@ public:
return utility::BigFloat(val);
}
template <class T>
float readValBig(typename std::enable_if<std::is_same<T, float>::value>::type* = 0) {
float readValBig(std::enable_if_t<std::is_same_v<T, float>>* = nullptr) {
return readFloatBig();
}
@ -447,7 +447,7 @@ public:
return m_endian == Big ? utility::BigDouble(val) : utility::LittleDouble(val);
}
template <class T>
double readVal(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) {
double readVal(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDouble();
}
@ -462,7 +462,7 @@ public:
return utility::LittleDouble(val);
}
template <class T>
double readValLittle(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) {
double readValLittle(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDoubleLittle();
}
@ -477,7 +477,7 @@ public:
return utility::BigDouble(val);
}
template <class T>
double readValBig(typename std::enable_if<std::is_same<T, double>::value>::type* = 0) {
double readValBig(std::enable_if_t<std::is_same_v<T, double>>* = nullptr) {
return readDoubleBig();
}
@ -491,15 +491,15 @@ public:
return val != 0;
}
template <class T>
bool readVal(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) {
bool readVal(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool();
}
template <class T>
bool readValLittle(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) {
bool readValLittle(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool();
}
template <class T>
bool readValBig(typename std::enable_if<std::is_same<T, bool>::value>::type* = 0) {
bool readValBig(std::enable_if_t<std::is_same_v<T, bool>>* = nullptr) {
return readBool();
}
@ -525,7 +525,7 @@ public:
return s;
}
template <class T>
atVec2f readVal(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) {
atVec2f readVal(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2f();
}
@ -546,7 +546,7 @@ public:
return s;
}
template <class T>
atVec2f readValLittle(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) {
atVec2f readValLittle(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2fLittle();
}
@ -567,7 +567,7 @@ public:
return s;
}
template <class T>
atVec2f readValBig(typename std::enable_if<std::is_same<T, atVec2f>::value>::type* = 0) {
atVec2f readValBig(std::enable_if_t<std::is_same_v<T, atVec2f>>* = nullptr) {
return readVec2fBig();
}
@ -594,7 +594,7 @@ public:
return s;
}
template <class T>
atVec3f readVal(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) {
atVec3f readVal(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3f();
}
@ -615,7 +615,7 @@ public:
return s;
}
template <class T>
atVec3f readValLittle(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) {
atVec3f readValLittle(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3fLittle();
}
@ -636,7 +636,7 @@ public:
return s;
}
template <class T>
atVec3f readValBig(typename std::enable_if<std::is_same<T, atVec3f>::value>::type* = 0) {
atVec3f readValBig(std::enable_if_t<std::is_same_v<T, atVec3f>>* = nullptr) {
return readVec3fBig();
}
@ -664,7 +664,7 @@ public:
return s;
}
template <class T>
atVec4f readVal(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) {
atVec4f readVal(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4f();
}
@ -685,7 +685,7 @@ public:
return s;
}
template <class T>
atVec4f readValLittle(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) {
atVec4f readValLittle(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4fLittle();
}
@ -706,7 +706,7 @@ public:
return s;
}
template <class T>
atVec4f readValBig(typename std::enable_if<std::is_same<T, atVec4f>::value>::type* = 0) {
atVec4f readValBig(std::enable_if_t<std::is_same_v<T, atVec4f>>* = nullptr) {
return readVec4fBig();
}
@ -732,7 +732,7 @@ public:
return s;
}
template <class T>
atVec2d readVal(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) {
atVec2d readVal(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2d();
}
@ -753,7 +753,7 @@ public:
return s;
}
template <class T>
atVec2d readValLittle(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) {
atVec2d readValLittle(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2dLittle();
}
@ -774,7 +774,7 @@ public:
return s;
}
template <class T>
atVec2d readValBig(typename std::enable_if<std::is_same<T, atVec2d>::value>::type* = 0) {
atVec2d readValBig(std::enable_if_t<std::is_same_v<T, atVec2d>>* = nullptr) {
return readVec2dBig();
}
@ -801,7 +801,7 @@ public:
return s;
}
template <class T>
atVec3d readVal(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) {
atVec3d readVal(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3d();
}
@ -822,7 +822,7 @@ public:
return s;
}
template <class T>
atVec3d readValLittle(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) {
atVec3d readValLittle(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3dLittle();
}
@ -843,7 +843,7 @@ public:
return s;
}
template <class T>
atVec3d readValBig(typename std::enable_if<std::is_same<T, atVec3d>::value>::type* = 0) {
atVec3d readValBig(std::enable_if_t<std::is_same_v<T, atVec3d>>* = nullptr) {
return readVec3dBig();
}
@ -871,7 +871,7 @@ public:
return s;
}
template <class T>
atVec4d readVal(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) {
atVec4d readVal(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4d();
}
@ -892,7 +892,7 @@ public:
return s;
}
template <class T>
atVec4d readValLittle(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) {
atVec4d readValLittle(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4dLittle();
}
@ -913,7 +913,7 @@ public:
return s;
}
template <class T>
atVec4d readValBig(typename std::enable_if<std::is_same<T, atVec4d>::value>::type* = 0) {
atVec4d readValBig(std::enable_if_t<std::is_same_v<T, atVec4d>>* = nullptr) {
return readVec4dBig();
}
@ -944,7 +944,7 @@ public:
return ret;
}
template <class T>
std::string readVal(typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0) {
std::string readVal(std::enable_if_t<std::is_same_v<T, std::string>>* = nullptr) {
return readString();
}
@ -976,7 +976,7 @@ public:
return ret;
}
template <class T>
std::wstring readVal(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) {
std::wstring readVal(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWString();
}
@ -1009,7 +1009,7 @@ public:
return ret;
}
template <class T>
std::wstring readValLittle(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) {
std::wstring readValLittle(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWStringLittle();
}
@ -1041,7 +1041,7 @@ public:
return ret;
}
template <class T>
std::wstring readValBig(typename std::enable_if<std::is_same<T, std::wstring>::value>::type* = 0) {
std::wstring readValBig(std::enable_if_t<std::is_same_v<T, std::wstring>>* = nullptr) {
return readWStringBig();
}
@ -1073,7 +1073,7 @@ public:
return ret;
}
template <class T>
std::u16string readValBig(typename std::enable_if<std::is_same<T, std::u16string>::value>::type* = 0) {
std::u16string readValBig(std::enable_if_t<std::is_same_v<T, std::u16string>>* = nullptr) {
return readU16StringBig();
}
@ -1105,7 +1105,7 @@ public:
return ret;
}
template <class T>
std::u32string readValBig(typename std::enable_if<std::is_same<T, std::u32string>::value>::type* = 0) {
std::u32string readValBig(std::enable_if_t<std::is_same_v<T, std::u32string>>* = nullptr) {
return readU32StringBig();
}
@ -1117,10 +1117,9 @@ public:
* Endianness is set with setEndian
*/
template <class T>
void
enumerate(std::vector<T>& vector, size_t count,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerate(std::vector<T>& vector, size_t count,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> || std::is_same_v<T, atVec3f> ||
std::is_same_v<T, atVec4f>>* = nullptr) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < count; ++i)
@ -1135,10 +1134,9 @@ public:
* Endianness is little
*/
template <class T>
void enumerateLittle(
std::vector<T>& vector, size_t count,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerateLittle(std::vector<T>& vector, size_t count,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < count; ++i)
@ -1153,10 +1151,9 @@ public:
* Endianness is big
*/
template <class T>
void
enumerateBig(std::vector<T>& vector, size_t count,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerateBig(std::vector<T>& vector, size_t count,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < count; ++i)
@ -1169,10 +1166,9 @@ public:
* @param count The number of elements to read into vector
*/
template <class T>
void
enumerate(std::vector<T>& vector, size_t count,
typename std::enable_if<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value &&
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerate(std::vector<T>& vector, size_t count,
std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> &&
!std::is_same_v<T, atVec3f> && !std::is_same_v<T, atVec4f>>* = nullptr) {
vector.clear();
vector.reserve(count);
for (size_t i = 0; i < count; ++i) {

View File

@ -989,10 +989,9 @@ public:
* Endianness is set with setEndian
*/
template <class T>
void
enumerate(const std::vector<T>& vector,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerate(const std::vector<T>& vector,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> || std::is_same_v<T, atVec3f> ||
std::is_same_v<T, atVec4f>>* = nullptr) {
for (const T& item : vector)
writeVal(item);
}
@ -1003,10 +1002,9 @@ public:
* Endianness is little
*/
template <class T>
void enumerateLittle(
const std::vector<T>& vector,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerateLittle(const std::vector<T>& vector,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
for (const T& item : vector)
writeValLittle(item);
}
@ -1017,10 +1015,9 @@ public:
* Endianness is big
*/
template <class T>
void
enumerateBig(const std::vector<T>& vector,
typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, atVec2f>::value ||
std::is_same<T, atVec3f>::value || std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerateBig(const std::vector<T>& vector,
std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, atVec2f> ||
std::is_same_v<T, atVec3f> || std::is_same_v<T, atVec4f>>* = nullptr) {
for (const T& item : vector)
writeValBig(item);
}
@ -1029,10 +1026,9 @@ public:
* @param vector The std::vector read from when writing data
*/
template <class T>
void
enumerate(const std::vector<T>& vector,
typename std::enable_if<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value &&
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>::type* = 0) {
void enumerate(const std::vector<T>& vector,
std::enable_if_t<!std::is_arithmetic_v<T> && !std::is_same_v<T, atVec2f> &&
!std::is_same_v<T, atVec3f> && !std::is_same_v<T, atVec4f>>* = nullptr) {
for (const T& item : vector)
item.write(*this);
}

View File

@ -54,7 +54,7 @@ public:
RecordRAII enterSubRecord(const char* name);
template <class T>
void enumerate(const char* name, T& record, typename std::enable_if_t<__IsDNARecord_v<T>>* = 0) {
void enumerate(const char* name, T& record, std::enable_if_t<__IsDNARecord_v<T>>* = nullptr) {
if (auto rec = enterSubRecord(name))
record.read(*this);
}
@ -77,10 +77,9 @@ public:
VectorRAII enterSubVector(const char* name, size_t& countOut);
template <class T>
size_t
enumerate(const char* name, std::vector<T>& vector,
typename std::enable_if_t<!std::is_arithmetic<T>::value && !std::is_same<T, atVec2f>::value &&
!std::is_same<T, atVec3f>::value && !std::is_same<T, atVec4f>::value>* = 0) {