Skip to content

Commit c8502f4

Browse files
Put curly brackets around nested inspected values and provide formatter for StringLiteral
Signed-off-by: Christian Parpart <christian@parpart.family>
1 parent 9091dbd commit c8502f4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/reflection-cpp/reflection.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ std::string Inspect(Object const& object)
446446
}
447447
else
448448
{
449+
str += '{';
449450
str += Inspect(arg);
451+
str += '}';
450452
}
451453
};
452454
if (!str.empty())
@@ -472,3 +474,12 @@ std::string Inspect(std::vector<Object> const& objects)
472474
return str;
473475
}
474476
} // namespace Reflection
477+
478+
template <std::size_t N>
479+
struct std::formatter<Reflection::StringLiteral<N>>: std::formatter<std::string_view>
480+
{
481+
auto format(Reflection::StringLiteral<N> const& value, auto& ctx) const
482+
{
483+
return formatter<std::string_view>::format(value.sv(), ctx);
484+
}
485+
};

0 commit comments

Comments
 (0)