2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00

Updated docs and enabled Loophole by default

This commit is contained in:
Antony Polukhin
2017-09-16 21:19:41 +03:00
parent 14d59f5340
commit b67893d92e
4 changed files with 33 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ Develop: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg
Master: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=master)](https://travis-ci.org/apolukhin/magic_get) <!-- [![Build status](https://ci.appveyor.com/api/projects/status/t6q6yhcabtk5b99l/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/boost-dll/branch/master) --> | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=master)](https://coveralls.io/github/apolukhin/magic_get?branch=master) | <!-- [details...](http://www.boost.org/development/tests/master/developer/pfr.html)) -->
### C++14 Motivating Example
### Motivating Example #1
```c++
// requires: C++14
#include <iostream>
@@ -42,9 +42,10 @@ Outputs:
my_struct has 3 fields: {100, H, 3.14159}
```
### C++17 Motivating Example
### Motivating Example #2
```c++
// requires: C++14
#include <iostream>
#include "boost/pfr.hpp"
@@ -54,7 +55,7 @@ struct my_struct { // no ostream operator defined!
};
int main() {
using namespace boost::pfr::ops; // C++17 out-of-the-box ostream operators for aggregate initializables!
using namespace boost::pfr::ops; // out-of-the-box ostream operators for aggregate initializables!
my_struct s{{"Das ist fantastisch!"}, 100};
std::cout << "my_struct has " << boost::pfr::tuple_size<my_struct>::value
@@ -74,14 +75,8 @@ my_struct has 2 fields: {"Das ist fantastisch!", 100}
General:
* C++14 compatible compiler (GCC-5.0+, Clang, ...)
* Static variables are ignored
C++14 limitations:
* T must be constexpr aggregate initializable and must not contain references nor bitfields
C++17 limitations:
* T must be aggregate initializable and must not contain arrays (but may contain `std::array` like classes)
### License
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).