]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hof/README.md
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / hof / README.md
CommitLineData
92f5a8d4 1# Boost.Hof <a target="_blank" href="https://travis-ci.org/boostorg/hof">![Travis status][badge.Travis]</a> <a target="_blank" href="https://ci.appveyor.com/project/pfultz2/hof">![Appveyor status][badge.Appveyor]</a>
11fdf7f2
TL
2
3About
4=====
5
6HigherOrderFunctions is a header-only C++11/C++14 library that provides utilities for functions and function objects, which can solve many problems with much simpler constructs than whats traditionally been done with metaprogramming.
7
8HigherOrderFunctions is:
9
92f5a8d4 10- Modern: HigherOrderFunctions takes advantages of modern C++11/C++14 features. It support both `constexpr` initialization and `constexpr` evaluation of functions. It takes advantage of type deduction, variadic templates, and perfect forwarding to provide a simple and modern interface.
11fdf7f2
TL
11- Relevant: HigherOrderFunctions provides utilities for functions and does not try to implement a functional language in C++. As such, HigherOrderFunctions solves many problems relevant to C++ programmers, including initialization of function objects and lambdas, overloading with ordering, improved return type deduction, and much more.
12- Lightweight: HigherOrderFunctions builds simple lightweight abstraction on top of function objects. It does not require subscribing to an entire framework. Just use the parts you need.
13
14HigherOrderFunctions is divided into three components:
15
16* Function Adaptors and Decorators: These enhance functions with additional capability.
17* Functions: These return functions that achieve a specific purpose.
18* Utilities: These are general utilities that are useful when defining or using functions
19
92f5a8d4 20Github: [https://github.com/boostorg/hof/](https://github.com/boostorg/hof/)
11fdf7f2 21
92f5a8d4 22Documentation: [http://boost-hof.readthedocs.io/](http://boost-hof.readthedocs.io/)
11fdf7f2
TL
23
24Motivation
25==========
26
92f5a8d4 27- Improve the expressiveness and capabilities of functions, including first-class citizens for function overload set, extension methods, infix operators and much more.
11fdf7f2
TL
28- Simplify constructs in C++ that have generally required metaprogramming
29- Enable point-free style programming
30- Workaround the limitations of lambdas in C++14
31
32Requirements
33============
34
35This requires a C++11 compiler. There are no third-party dependencies. This has been tested on clang 3.5-3.8, gcc 4.6-7, and Visual Studio 2015 and 2017.
36
37Contexpr support
38----------------
39
40Both MSVC and gcc 4.6 have limited constexpr support due to many bugs in the implementation of constexpr. However, constexpr initialization of functions is supported when using the [`BOOST_HOF_STATIC_FUNCTION`](BOOST_HOF_STATIC_FUNCTION) and [`BOOST_HOF_STATIC_LAMBDA_FUNCTION`](BOOST_HOF_STATIC_LAMBDA_FUNCTION) constructs.
41
42Noexcept support
43----------------
44
45On older compilers such as gcc 4.6 and gcc 4.7, `noexcept` is not used due to many bugs in the implementation. Also, most compilers don't support deducing `noexcept` with member function pointers. Only newer versions of gcc(4.9 and later) support this.
46
47Building
48========
49
50Boost.HigherOrderFunctions library uses cmake to build. To configure with cmake create a build directory, and run cmake:
51
52 mkdir build
53 cd build
54 cmake ..
55
56Installing
57----------
58
59To install the library just run the `install` target:
60
61 cmake --build . --target install
62
63Tests
64-----
65
66The tests can be built and run by using the `check` target:
67
68 cmake --build . --target check
69
70The tests can also be ran using Boost.Build, just copy library to the boost source tree, and then:
71
72 cd test
73 b2
74
75Documentation
76-------------
77
78The documentation is built using Sphinx. First, install the requirements needed for the documentation using `pip`:
79
80 pip install -r doc/requirements.txt
81
82Then html documentation can be generated using `sphinx-build`:
83
84 sphinx-build -b html doc/ doc/html/
85
86The final docs will be in the `doc/html` folder.
87
92f5a8d4
TL
88<!-- Links -->
89[badge.Travis]: https://travis-ci.org/boostorg/hof.svg?branch=master
90[badge.Appveyor]: https://ci.appveyor.com/api/projects/status/bjj27h3v3bxbgpsp/branch/develop