Skip to content

Commit 5b80f4d

Browse files
committed
[pfr_view] Fixed PFR limitation
1 parent 7b823f6 commit 5b80f4d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/sequence/pfr_fields_view.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ namespace ns {
4141

4242
struct guaranteed_nonconstexpr_string {
4343
std::string value;
44-
template<typename T>
45-
/*explicit*/ guaranteed_nonconstexpr_string(T value) : value(std::move(value)) {
44+
explicit guaranteed_nonconstexpr_string(std::string value) : value(std::move(value)) {
4645
std::cout << "mark to ensure nonconstexpr" << std::endl;
4746
}
4847
};
@@ -145,12 +144,14 @@ main()
145144

146145
#if BOOST_PFR_USE_CPP17 != 0
147146
{
148-
ns::employee emp{"John Doe", "jdoe"};
147+
ns::employee emp{guaranteed_nonconstexpr_string("John Doe"),
148+
guaranteed_nonconstexpr_string("jdoe")};
149149
pfr_fields_view<ns::employee> view(emp);
150150
std::cout << at_c<0>(view).value << std::endl;
151151
std::cout << at_c<1>(view).value << std::endl;
152152

153-
fusion::vector<ns::guaranteed_nonconstexpr_string, ns::guaranteed_nonconstexpr_string> v1("John Doe", "jdoe");
153+
fusion::vector<ns::guaranteed_nonconstexpr_string, ns::guaranteed_nonconstexpr_string> v1(
154+
guaranteed_nonconstexpr_string("John Doe"), guaranteed_nonconstexpr_string("jdoe"));
154155
BOOST_TEST(view == v1);
155156
}
156157
#endif // BOOST_PFR_USE_CPP17

0 commit comments

Comments
 (0)