Go to file
2018-10-09 15:12:48 -05:00
cmake Doc updates 2017-09-06 11:52:16 -05:00
doc Add license to markdown files 2018-02-20 20:27:31 -06:00
example Add more license headers 2018-02-15 23:55:11 -06:00
include/boost Fix by to proj 2018-08-24 01:19:24 +09:00
meta Add function objects to meta file 2018-02-17 23:53:45 -06:00
test Merge from master 2018-02-27 14:03:03 -06:00
.gitattributes Add .gitattributes for end of line settings 2018-02-15 19:48:35 +00:00
.gitignore Add gitignore file to ignore local build and docs files 2018-06-13 03:02:41 +05:30
.travis.yml Dont build examples for c++11 2018-02-19 10:06:33 -06:00
appveyor.yml Boostify 2018-02-14 14:54:32 -06:00
boost_hof.pc.in Rename to boost_hof 2018-02-15 20:56:57 -06:00
CMakeLists.txt Fix test with clang using c++11 2018-02-18 23:10:04 -06:00
index.html Add index.html file 2018-02-16 09:37:49 -06:00
LICENSE.md Add license file 2018-02-20 19:45:57 -06:00
README.md Fix links and typos 2018-10-09 21:18:17 +03:00

Boost.Hof Travis status Appveyor status

About

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.

HigherOrderFunctions is:

  • 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.
  • 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.
  • 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.

HigherOrderFunctions is divided into three components:

  • Function Adaptors and Decorators: These enhance functions with additional capability.
  • Functions: These return functions that achieve a specific purpose.
  • Utilities: These are general utilities that are useful when defining or using functions

Github: https://github.com/boostorg/hof/

Documentation: http://boost-hof.readthedocs.io/

Motivation

  • Improve the expressiveness and capabilities of functions, including first-class citizens for function overload set, extension methods, infix operators and much more.
  • Simplify constructs in C++ that have generally required metaprogramming
  • Enable point-free style programming
  • Workaround the limitations of lambdas in C++14

Requirements

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.

Contexpr support

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 and BOOST_HOF_STATIC_LAMBDA_FUNCTION constructs.

Noexcept support

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.

Building

Boost.HigherOrderFunctions library uses cmake to build. To configure with cmake create a build directory, and run cmake:

mkdir build
cd build
cmake ..

Installing

To install the library just run the install target:

cmake --build . --target install

Tests

The tests can be built and run by using the check target:

cmake --build . --target check

The tests can also be ran using Boost.Build, just copy library to the boost source tree, and then:

cd test
b2

Documentation

The documentation is built using Sphinx. First, install the requirements needed for the documentation using pip:

pip install -r doc/requirements.txt

Then html documentation can be generated using sphinx-build:

sphinx-build -b html doc/ doc/html/

The final docs will be in the doc/html folder.