About non-intrusive polymorphism

Polymorphism in C++

C++ implements subtyping polymorphism in the form of virtual functions, member functions that should be overridden on derived classes, in a way each class implements its own behavior for the function:

Continue reading

Criticizing the Rust Language, and Why C and C++ Will Never Die

This is an original text by Eax Melanhovich that was rigourosly translated and kindly shared by Andrey Karpov. The original translation can be found here. Many thanks to both. 

Why C and C++ Will Never Die

I couldn’t but notice how much interest the readers of this blog [the author’s blog] had shown in the topic “should we let kittens play with new balls of wool?” So I felt like sharing a few more of my reflections on a related subject in regard to the C and C++ languages and the odds that Rust will kill them. No need to tell you that it will inevitably cause a big holy war, so before you proceed, think twice if you really want to go on reading this post and especially participate in a “constructive debate” via comments.

Continue reading

Boost libraries are now supported in biicode

As a C++ developer I love the Boost libraries. They are one of the highest quality and best suited C++ libraries in the world, with the spirit and design of being fully compatible with the standard library and its practices.

However, Boost is not easy to love. It’s shipped with tons of inter-dependencies, even circular dependencies, and that’s only for header-only libraries (thankfully 80% of Boost is header-only). For non header-only libs, it’s a true pain. You should compile those and then link against, being careful about what you are doing.
Even if setting up Boost manually could be a bit hard, when it works it’s a pleasure to develop with it.

At biicode we have been working hard to simplify the process, to make Boost available for any C++ programmer with just an include. But this is only the start, the project has been released as open source to allow everyone contribute and help.

I hope you like it.
Boost libraries are finally supported in biicode

Continue reading

A Tiny Metaprogramming Library

It seems people like template metaprogramming. After three successful blog posts about tmp – with 5k views on average each one – I’m sure people like and even want to understand that obscure corner of C++.

It’s not a funny way to play with the compiler only, template metaprogramming is a powerful tool for C++ developers and something that many of us must deal with everyday.

Continue reading

CMake Tutorial to build better biicode projects

Biicode is a C and C++ dependency manager. And uses CMake to configure and build your projects. Hope there are no surprises here!

This post is a CMake Tutorial to understand the basics of generating biicode projects for your usual tools and some tips to make projects multi-os compatible via CMakeLists.txt.

Custom CMake toolchain is now a feature in biicode

Continue reading

Bit-parallel approximate coloring

The vertex coloring problem (VCP) is an NP-hard classical problem in graph theory which can be traced back to a letter written to W.R. Hamilton by A. de Morgan in 1852 in which the famous Four Color Theorem has its roots. Besides its obvious theoretical relevance, it has found practical applications connected to scheduling and allocation of resources (i.e. memory for different processes, frequencies for WLANs etc.).
A (proper) vertex coloring of a simple undirected graph G=(V, E) is an assignment of color numbers to all vertices such that pairwise adjacent vertices have different colors. The size of the coloring is the number of different colors employed. The chromatic number of a graph χ(G) is the minimum number of colors required to color G, i.e. the size of its optimum coloring. The VCP can be formulated as finding a minimum coloring for a given graph.
Compared with other related graph optimization problems such as the maximum clique problem (i.e. finding the largest possible subgraph in a given graph), VCP is considerably more challenging; for example it is possible to compute a maximum clique exactly in massive sparse graphs with millions of vertices, whereas fast exact coloring of a random graph with 80 vertices and 0.5 edge density already requires efficient algorithms and a powerful CPU.

Continue reading

BITSCAN: a C++ library for bit strings

A comprehensive view of BITSCAN

BITSCAN is a C++ library dedicated to efficient processing of bit strings. In programming, a bit string is a data structure that stores collections of bits (ones and zeros). It gets interesting when these bits have semantics, i.e.  refer to a Boolean property of a group, so that each element is identified by a bit in the chain. In previous posts I have repeatedly stated that BITSCAN “is a useful library to manage bit strings”, and that was that. Readers of our blog have questioned the usefulness of bit strings in practice so I will start this post explaining some common situations in which bit strings may be an alternative to more common data structures.

Bit strings can now be processed more powerfully with BITSCAN hosted in biicode

Continue reading

Why a FILE BASED dependency manager rocks for C/C++

We have a big problem. We have miserably failed to explain the core value proposition of biicode: a file-based dependency manager. We have tried to communicate it in the homepage, in features landing pages, videos, etc. While we certainly are growing, it is also true that not as fast as we would like.

There are many reasons that explain this: People understand that we are a dependency manager for C/C++, but also realize that we still don’t have premium accounts (for private code), in-house deployment or that we’re not open-source. This is all true, we are working in all these features, including going open-source regarding which we will soon announce something relevant. But we think these are not reasons (stoppers) enough to not engage with the platform now, try it, check how it works, give feedback to help define the tool to your needs.

We believe that the main problem is that we didn’t explain properly what makes biicode so special, and we failed because we have used the wrong channels. Here, I will explain it with the language we, developers, all love: source code.

C/C++ dependency manager

Continue reading

Template Metaprogramming with Modern C++: templates in depth

Template Metaprogramming with Modern C++: Templates in depth

The last time  we learnt what metaprogramming was, how metaprogramming in C++ via templates works, and the functional spirit of the embedded language that C++ template metaprogramming is.

In this post we will learn C++ templates in depth: Class and function templates, template parameters, variadic templates, all with in depth examples.
SPOILER: Finally, there is no SFINAE explanation on this post. This has a large amount of contents to be read and understood, I think understanding correctly the template system and the different categories of template parameters is good enough for a single (But large) blog post. Of course, if there is any problem feel free to post a comment here.

Template Metaprogramming Modern C++ in biicode
Continue reading