#ifndef RFL_PARSING_PARSER_C_ARRAY_HPP_ #define RFL_PARSING_PARSER_C_ARRAY_HPP_ #include #include "../Array.hpp" #include "../Result.hpp" #include "../always_false.hpp" #include "../internal/to_std_array.hpp" #include "Parser_array.hpp" #include "Parser_base.hpp" namespace rfl { namespace parsing { template requires AreReaderAndWriter struct Parser { public: using InputArrayType = typename R::InputArrayType; using InputVarType = typename R::InputVarType; using OutputArrayType = typename W::OutputArrayType; using OutputVarType = typename W::OutputVarType; using CArray = T[_size]; using StdArray = internal::to_std_array_t; static Result> read(const R& _r, const InputVarType& _var) noexcept { return Parser::read(_r, _var); } static OutputVarType write(const W& _w, const CArray& _arr) noexcept { auto arr = _w.new_array(); for (const auto& e : _arr) { _w.add(Parser>::write(_w, e), &arr); } return OutputVarType(arr); } }; } // namespace parsing } // namespace rfl #endif