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:
29
build-config/reflect-cpp/include/rfl/internal/VisitTree.hpp
Normal file
29
build-config/reflect-cpp/include/rfl/internal/VisitTree.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef RFL_INTERNAL_VISITTREE_HPP_
|
||||
#define RFL_INTERNAL_VISITTREE_HPP_
|
||||
|
||||
namespace rfl {
|
||||
namespace internal {
|
||||
|
||||
struct VisitTree {
|
||||
/// Evaluates a visitor pattern using a tree-like structure.
|
||||
template <int _begin, int _end, class Visitor, class... Args>
|
||||
static inline auto visit(const auto& _v, const int _i,
|
||||
const Args&... _args) {
|
||||
static_assert(_end > _begin, "_end needs to be greater than _begin.");
|
||||
if constexpr (_end - _begin == 1) {
|
||||
return _v.template visit<_begin>(_args...);
|
||||
} else {
|
||||
constexpr int middle = (_begin + _end) / 2;
|
||||
if (_i < middle) {
|
||||
return visit<_begin, middle, Visitor>(_v, _i, _args...);
|
||||
} else {
|
||||
return visit<middle, _end, Visitor>(_v, _i, _args...);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user