feat(reflect-cpp): Switched from glaze -> reflect cpp
A bug was discovered in glaze which prevented valid toml output. We have switched to toml++ and reflect-cpp. The interface has remained the same so this should not break any code
This commit is contained in:
32
build-config/reflect-cpp/include/rfl/thirdparty/enchantum/istream.hpp
vendored
Normal file
32
build-config/reflect-cpp/include/rfl/thirdparty/enchantum/istream.hpp
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "enchantum.hpp"
|
||||
#include <concepts>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
namespace enchantum::istream_operators {
|
||||
template<typename Traits, Enum E>
|
||||
requires std::assignable_from<E&, E>
|
||||
std::basic_istream<char, Traits>& operator>>(std::basic_istream<char, Traits>& is, E& value)
|
||||
{
|
||||
std::basic_string<char, Traits> s;
|
||||
is >> s;
|
||||
if (!is)
|
||||
return is;
|
||||
|
||||
if constexpr (is_bitflag<E>) {
|
||||
if (const auto v = enchantum::cast_bitflag<E>(s))
|
||||
value = *v;
|
||||
else
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
else {
|
||||
if (const auto v = enchantum::cast<E>(s))
|
||||
value = *v;
|
||||
else
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
} // namespace enchantum::istream_operators
|
||||
Reference in New Issue
Block a user