![]() ![]() First, we have runtime computations, which are the usual computations we use in C++. ![]() We will focus our attention on four different kinds of computations, even though a finer grained separation would be possible. By unifying both concepts, metaprogramming becomes easier and new exciting possibilities open before us.īut to really understand what is Hana all about, it is essential to understand the different types of computations in C++. The key insight to Hana is that the manipulation of types and values are nothing but two sides of the same coin. A natural question then arises: is it still desirable to have abstractions for metaprogramming, and if so, which ones? After investigating different options like the MPL11, the answer eventually came by itself in the form of a library Hana. Recently, C++11 and C++14 brought many major changes to the language, some of which make metaprogramming much easier, while others drastically widen the design space for libraries. ![]() This breakthrough greatly contributed to making C++ template metaprogramming more mainstream, and today the discipline is deeply rooted in many serious projects. When Boost.MPL first appeared, it provided C++ programmers with a huge relief by abstracting tons of template hackery behind a workable interface. If you are encountering what you think is a bug, please open an issue. StackOverflow with the boost-hana tag is the preferred place to ask questions on usage. If that doesn't help, feel free to chat with us in Gitter, or open a new issue. Searching the issues for your problem is also a good idea. If you have a problem, please review the FAQ and the wiki. More information for specific platforms is available on the wiki. All the C++14 type traits from the header.More specifically, Hana requires a compiler/standard library supporting the following C++14 features (non-exhaustively): Here is a table of the current C++14 compilers/toolchains with comments regarding support for Hana: Compiler/Toolchainįully working tested on each push to GitHub The library relies on a C++14 compiler and standard library, but nothing else is required. Finally, if you want to contribute to Hana, you can see how to best setup your environment for development in the README. The module also allows installing Hana locally to that project, without needing to install Hana on the system per the above instructions. If you use CMake in a project, you can use the provided FindHana.cmake module to setup Hana as an external CMake project. Do not install Hana as shown above if you already have an installation of Boost, because the new installation will overwrite the one that comes with Boost.The manual installation will also install a hana.pc file for use with pkg-config.DCMAKE_INSTALL_PREFIX=/custom/install/prefix Note To do so, you can download the code from the official GitHub repository and install the library manually by issuing the following commands from the root of the project (requires CMake):ġ cmake. If you do not want to install all of Boost, it is also possible to install Hana only. First, you can install Boost 1.61.0 or later, since Hana is included in Boost starting with that release. However, if you want to cleanly install Hana on your system, you have a couple of options. Basically, just add the include/ directory to your compiler's header search path and you are done. Hence, using Hana in your own project is very easy. Hana is a header-only library without external dependencies (not even the rest of Boost). ![]() Hana is easy to extend in a ad-hoc manner and it provides out-of-the-box inter-operation with Boost.Fusion, Boost.MPL and the standard library. By leveraging C++11/14 implementation techniques and idioms, Hana boasts faster compilation times and runtime performance on par or better than previous metaprogramming libraries, while noticeably increasing the level of expressiveness in the process. The functionality it provides is a superset of what is provided by the well established Boost.MPL and Boost.Fusion libraries. Hana is a header-only library for C++ metaprogramming suited for computations on both types and values.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |