]>
Commit | Line | Data |
---|---|---|
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 | |
3 | About | |
4 | ===== | |
5 | ||
6 | HigherOrderFunctions 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 | ||
8 | HigherOrderFunctions 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 | ||
14 | HigherOrderFunctions 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 | 20 | Github: [https://github.com/boostorg/hof/](https://github.com/boostorg/hof/) |
11fdf7f2 | 21 | |
92f5a8d4 | 22 | Documentation: [http://boost-hof.readthedocs.io/](http://boost-hof.readthedocs.io/) |
11fdf7f2 TL |
23 | |
24 | Motivation | |
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 | ||
32 | Requirements | |
33 | ============ | |
34 | ||
35 | This 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 | ||
37 | Contexpr support | |
38 | ---------------- | |
39 | ||
40 | Both 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 | ||
42 | Noexcept support | |
43 | ---------------- | |
44 | ||
45 | On 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 | ||
47 | Building | |
48 | ======== | |
49 | ||
50 | Boost.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 | ||
56 | Installing | |
57 | ---------- | |
58 | ||
59 | To install the library just run the `install` target: | |
60 | ||
61 | cmake --build . --target install | |
62 | ||
63 | Tests | |
64 | ----- | |
65 | ||
66 | The tests can be built and run by using the `check` target: | |
67 | ||
68 | cmake --build . --target check | |
69 | ||
70 | The 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 | ||
75 | Documentation | |
76 | ------------- | |
77 | ||
78 | The documentation is built using Sphinx. First, install the requirements needed for the documentation using `pip`: | |
79 | ||
80 | pip install -r doc/requirements.txt | |
81 | ||
82 | Then html documentation can be generated using `sphinx-build`: | |
83 | ||
84 | sphinx-build -b html doc/ doc/html/ | |
85 | ||
86 | The 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 |