boostorg / Pfr
Licence: bsl-1.0
std::tuple like methods for user defined types without any macro or boilerplate code
Stars: ✭ 896
Programming Languages
Projects that are alternatives of or similar to Pfr
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-87.83%)
Mutual labels: clang, gcc, visual-studio
Stdex
std C++ 11 library impementation with extra features using only C++ 98 and POSIX threads
Stars: ✭ 43 (-95.2%)
Mutual labels: gcc, visual-studio, boost
ci playground
Playground for Cloud CI development for C++
Stars: ✭ 23 (-97.43%)
Mutual labels: visual-studio, gcc, clang
FrameOfReference
C++ library to pack and unpack vectors of integers having a small range of values using a technique called Frame of Reference
Stars: ✭ 36 (-95.98%)
Mutual labels: visual-studio, gcc, clang
Ci helloworld
A simple example of how to setup a complete CI environment for C and C++
Stars: ✭ 357 (-60.16%)
Mutual labels: clang, gcc, visual-studio
Vector
➿ A supercharged std::vector implementation (minus Allocator)
Stars: ✭ 118 (-86.83%)
Mutual labels: clang, gcc, visual-studio
Boomerang
Boomerang Decompiler - Fighting the code-rot :)
Stars: ✭ 265 (-70.42%)
Mutual labels: clang, gcc, visual-studio
Sol2
Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
Stars: ✭ 2,791 (+211.5%)
Mutual labels: clang, gcc, visual-studio
Croaring
Roaring bitmaps in C (and C++)
Stars: ✭ 735 (-17.97%)
Mutual labels: clang, gcc, visual-studio
cdetect
🔬 Detect which compiler and compiler version a Linux executable (in the ELF format) was compiled with
Stars: ✭ 23 (-97.43%)
Mutual labels: gcc, clang
hmg
💝 My personal Gentoo/Linux configuration backup files
Stars: ✭ 16 (-98.21%)
Mutual labels: gcc, clang
rebuild
Zero-dependency, reproducible build environments
Stars: ✭ 48 (-94.64%)
Mutual labels: gcc, clang
cpp-compiler-options
Compilation options for different versions of Clang, GCC and MSVC. Provided a generator and different file formats (cmake, xmake, meson, premake5, bjam/b2, ...)
Stars: ✭ 19 (-97.88%)
Mutual labels: gcc, clang
c-compiler-security
Security-related flags and options for C compilers
Stars: ✭ 125 (-86.05%)
Mutual labels: gcc, clang
minilib
A c standard system library with a focus on size, headeronly, "singlefile", intended for static linking. 187 Bytes for "Hello World"(regular elf), compiled with the standard gcc toolchain.
Stars: ✭ 29 (-96.76%)
Mutual labels: gcc, clang
rooki
A stupid simple script runner supporting c, c++, rust, haskell and virtually anything
Stars: ✭ 26 (-97.1%)
Mutual labels: gcc, clang
Usrefl
Header-only, tiny (99 lines) and powerful C++20 static reflection library.
Stars: ✭ 287 (-67.97%)
Mutual labels: clang, gcc
Boost.PFR
This is a C++14 library for very basic reflection that gives you access to structure elements by index and provides other std::tuple
like methods for user defined types without any macro or boilerplate code.
Test results
Branches | Build | Tests coverage | More info |
---|---|---|---|
Develop: |
|
![]() |
details... |
Master: |
|
![]() |
details... |
Motivating Example #0
#include <iostream>
#include <fstream>
#include <string>
#include "boost/pfr.hpp"
struct some_person {
std::string name;
unsigned birth_year;
};
int main(int argc, const char* argv[]) {
some_person val{"Edgar Allan Poe", 1809};
std::cout << boost::pfr::get<0>(val) // No macro!
<< " was born in " << boost::pfr::get<1>(val); // Works with any aggregate initializables!
if (argc > 1) {
std::ofstream ofs(argv[1]);
ofs << boost::pfr::io(val); // File now contains: {"Edgar Allan Poe", 1809}
}
}
Outputs:
Edgar Allan Poe was born in 1809
Motivating Example #1
#include <iostream>
#include "boost/pfr/precise.hpp"
struct my_struct { // no ostream operator defined!
int i;
char c;
double d;
};
int main() {
my_struct s{100, 'H', 3.141593};
std::cout << "my_struct has " << boost::pfr::tuple_size<my_struct>::value
<< " fields: " << boost::pfr::io(s) << "\n";
}
Outputs:
my_struct has 3 fields: {100, H, 3.14159}
Motivating Example #2
#include <iostream>
#include "boost/pfr/precise.hpp"
struct my_struct { // no ostream operator defined!
std::string s;
int i;
};
int main() {
my_struct s{{"Das ist fantastisch!"}, 100};
std::cout << "my_struct has " << boost::pfr::tuple_size<my_struct>::value
<< " fields: " << boost::pfr::io(s) << "\n";
}
Outputs:
my_struct has 2 fields: {"Das ist fantastisch!", 100}
Requirements and Limitations
License
Distributed under the Boost Software License, Version 1.0.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].