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:
13
README.md
13
README.md
@@ -15,7 +15,7 @@ Develop: | [](https://travis-ci.org/apolukhin/magic_get) <!-- [](https://ci.appveyor.com/project/apolukhin/boost-dll/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).
|
||||
|
||||
Reference in New Issue
Block a user