#ifndef RFL_PARSING_IS_REQUIRED_HPP_ #define RFL_PARSING_IS_REQUIRED_HPP_ #include #include #include #include "../Rename.hpp" #include "../internal/StringLiteral.hpp" #include "../internal/is_rename.hpp" #include "is_map_like.hpp" #include "is_vector_like.hpp" namespace rfl { namespace parsing { /// Determines whether a field in a named tuple is required. /// General case - most fields are required. template class is_never_required; template class is_never_required : public std::false_type {}; template class is_never_required> : public std::true_type {}; template class is_never_required> : public std::true_type {}; template class is_never_required> : public std::true_type {}; template constexpr bool is_never_required_v = is_never_required::value; template consteval bool is_required() { using Type = std::remove_cvref_t>; if constexpr (internal::has_reflection_type_v) { return is_required(); } else if constexpr (internal::is_rename_v) { return is_required(); } else { return !( is_never_required_v || (_ignore_empty_containers && (is_vector_like_v || is_map_like_v)) ); } } } // namespace parsing } // namespace rfl #endif