mirror of https://github.com/libAthena/athena.git
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:
parent
03f9314a2a
commit
120b3d1281
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include "athena/DNA.hpp"
|
#include "athena/DNA.hpp"
|
||||||
#include "athena/FileReader.hpp"
|
#include "athena/FileReader.hpp"
|
||||||
|
@ -12,13 +11,12 @@
|
||||||
namespace athena::io {
|
namespace athena::io {
|
||||||
|
|
||||||
template <class T>
|
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();
|
return dna.DNATypeV();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline std::string_view __GetDNAName(const T& dna, std::enable_if_t<!athena::io::__IsDNAVRecord_v<T>>* = nullptr) {
|
|
||||||
return dna.DNAType();
|
return dna.DNAType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "athena/YAMLCommon.hpp"
|
#include "athena/YAMLCommon.hpp"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue