Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/rfl/Commented.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ template <class T>
struct Commented {
public:
using Type = std::remove_cvref_t<T>;
using ReflectionType = Type;

Commented() : value_(Type()) {}

Expand Down Expand Up @@ -134,6 +135,9 @@ struct Commented {
return *this;
}

/// Returns the underlying object.
const ReflectionType& reflection() const { return value_; }

/// Assigns the underlying object.
void set(const Type& _value) { value_ = _value; }

Expand Down
22 changes: 22 additions & 0 deletions tests/yaml/test_comment_optional_array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <gtest/gtest.h>

#include <array>
#include <optional>
#include <rfl/Commented.hpp>
#include <rfl/yaml.hpp>

#include "write_and_read.hpp"

namespace test_comment_optional_array {

struct VeryCoolYaml {
rfl::Commented<std::optional<std::array<unsigned, 3>>> optionalArray =
std::nullopt;
};

TEST(yaml, test_comment_optional_array) {
const auto yaml = VeryCoolYaml{};
write_and_read(yaml);
}

} // namespace test_comment_optional_array
Loading