Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Oct 2, 2021
1 parent e8ceba3 commit dc552cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions doc/pfr.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ user_info retrieve_friend(std::string_view name) {

db::insert(
"INSERT INTO user_infos(id, name, email, login) VALUES ($0, $1, $2, $3)",
std::move(friend_info.id), //////////////////////////////////////////////
std::move(friend_info.name), // Users are forced to move individual fields
std::move(friend_info.email), // because your library can not iterate over
std::move(friend_info.login) // the fields of a user provided structure
friend_info.id, /////////////////////////////////////////////////////////
friend_info.name, // Users are forced to enumerate fields because your
friend_info.email, // library can not iterate over the fields of a user
friend_info.login // provided structure
);

return friend_info;
Expand Down Expand Up @@ -94,8 +94,8 @@ user_info retrieve_friend(std::string_view name) {
db::insert(
"INSERT INTO user_infos(id, name, email, login) VALUES ($0, $1, $2, $3)",
friend_info ////////////////////////////////////////////////////////////
// PFR allows you to iterate over all the fields of a
// user provided structure
// PFR allows you to iterate over all the fields
// of a user provided structure
//
);

Expand Down Expand Up @@ -169,7 +169,7 @@ PFR adds the following out-of-the-box functionality for aggregate initializable
* methods for cooperation with `std::tuple`
* methods to visit each field of the structure

PFR is a header only library that does not depend on Boost. You can just copy the content of the "include" folder [@https://github.com/boostorg/pfr from the github] into your project, and the library will work fine.
PFR is a header only library that does not depend on Boost. You can just copy the content of the "include" folder [@https://github.com/boostorg/pfr from the PFR github] into your project, and the library will work fine. For a version of the library without `boost::` namespace see [@https://github.com/apolukhin/pfr_non_boost PFR].

[caution Recommended C++ Standards are C++17 and above. Library requires at least C++14! Pre C++14 compilers (C++11, C++03...) are not supported]

Expand Down
4 changes: 2 additions & 2 deletions include/pfr/detail/for_each_field_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void for_each_field_impl_apply(T&& v, F&& f, I /*i*/, int) {

template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::false_type /*move_values*/) {
const int v[] = {(
const int v[] = {0, (
detail::for_each_field_impl_apply(sequence_tuple::get<I>(t), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};
Expand All @@ -41,7 +41,7 @@ void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::false_type

template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::true_type /*move_values*/) {
const int v[] = {(
const int v[] = {0, (
detail::for_each_field_impl_apply(sequence_tuple::get<I>(std::move(t)), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};
Expand Down
1 change: 1 addition & 0 deletions include/pfr/detail/offset_based_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <type_traits>
#include <utility>
#include <memory> // std::addressof
#include <pfr/detail/sequence_tuple.hpp>
#include <pfr/detail/rvalue_t.hpp>
#include <pfr/detail/size_t_.hpp>
Expand Down

0 comments on commit dc552cf

Please sign in to comment.