DNAYaml: Collapse SFINAE functions into single function

We can leverage if constexpr here to determine which branch of code to
instantiate, eliminating the need for the use of SFINAE.
This commit is contained in:
Lioncash 2019-10-19 07:09:24 -04:00
parent 03f9314a2a
commit 120b3d1281
2 changed files with 7 additions and 8 deletions

View File

@ -1,7 +1,6 @@
#pragma once
#include <string>
#include <type_traits>
#include "athena/DNA.hpp"
#include "athena/FileReader.hpp"
@ -12,14 +11,13 @@
namespace athena::io {
template <class T>
inline std::string_view __GetDNAName(const T& dna, std::enable_if_t<athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
std::string_view __GetDNAName(const T& dna) {
if constexpr (__IsDNAVRecord_v<T>) {
return dna.DNATypeV();
}
template <class T>
inline std::string_view __GetDNAName(const T& dna, std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
} else {
return dna.DNAType();
}
}
template <class T>
std::string ToYAMLString(const T& dna) {

View File

@ -2,6 +2,7 @@
#include <cctype>
#include <cstdlib>
#include <type_traits>
#include "athena/YAMLCommon.hpp"