A Tiny Metaprogramming Library: Extending the Metaphor, entering metafunctions

I know I’m repeating this everytime I write a new article, but it’s one of the key points to make template metaprogramming feasible, which means: TMP is just a functional language. A language with a “Aghhhh, my eyes, please!!! Aaahhhhhg!!!” syntax, but still a functional language.

To start a C++ metaprogramming library the right way, we’d better have a clear idea of what a metafunction is, and how our library represents and manages a metafunction.

Continue reading

Metaprogramming with Modern C++: The Haskell Metaphor

I you are one of who have been following our post series about template metaprogramming with modern C++, at this time you should have become a C++ template Guru. At least thats what I expect ;).

You know about class templates, function templates, value parameters, type parameters, variadic templates… Your template metaprogramming toolbox is full of great things to play with. Thats good, but you want to start playing with your compiler, writting some cool metaprograms.

Lets start the game!

Continue reading

Template Metaprogramming with Modern C++: Introduction

Template Metaprogramming with Modern C++: Introduction

Any sufficiently complex C++ code is indistinguishable from trolling

Arthur C. Clarke

Preface

Template metaprogramming is one of the things that makes C++ that complex, poor known, and sometimes horrible language. However, its power and expressiveness are some of the best features of C++.

Extensible and fully generic C++ libraries aren’t possible without template metapogramming. Even the Standard Library implementations hide many template metaprogramming tricks to make standard containers and algorithms that generic, high level, and efficient tools we use everyday.

The fact that tmp is a powerful tool can be seen in the evolution of the language, which now has features designed to improve metaprogramming, see C++11 <type_traits>, C++11 variadic templates, C++14 variable templates, C++14std::integer_sequence, etc.

template metaprogramming

Credit: https://gitorious.org/metatrace

Continue reading

Meta-configuration with CMake of C/C++ projects

This blog post is out dated.

If you’re interested on knowing the updates, check our docs for more information.

Project configuration and setup

Project configuration in software development is the process of setting up how your code will be built, managed and/or run. It varies depending on the programming language and tools, as the IDE, used. For instance, when programming in C/C++, the project setup usually comes with defining which artifacts (executables, libraries) will be built from certain source code files, with given compiling and linking options. In Microsoft Visual, this can be mostly done with wizards, menu and contextual commands; e.g. you can configure your directories containing external libraries in a dialog (Project Properties).

 

Meta-configuration with CMake

Continue reading