Feeds:
Posts
Comments

Archive for the ‘cpp’ Category

The C-Preprocessor is a very powerful mechanism, which offers many different features. One of these features is called Variadic macros: macros that accept a varying number of arguments. It is interesting to note at this point, that such Variadic macros, despite being part of the C99 Standard, are not part of the C++ Standard at [...]

Read Full Post »

In the concurrent world, a Future object refers to an object whose actual value is to be computed in the future. You can think of it as a handle to an asynchronous invocation of a computation that yields a value. Many so called concurrent programming languages support this idea as a native construct offered by [...]

Read Full Post »

Quines

A Quine is a computer program which prints a copy of its own source code as its only output. Thus it is theoretically possible to compile such a program, run it, and then have its output compiled again to produce the initial program – in an infinite loop, forever.

Read Full Post »

The handler std::terminate() is called whenever the exception handling mechanism cannot find a suitable catch clause for a thrown exception (and in some other cases. For example, when an exception is thrown during the handling of another exception – see this GotW post about std::uncaught_exception). It is possible to define a custom handler by using [...]

Read Full Post »

The possibility of overloading just about any C++ operator and having it do something entirely different from what it was designed for, can sometimes make life pretty hard. Here are a couple of examples: What if you wanted to take the address of an object, which had implemented an entirely different semantic for the ampersand [...]

Read Full Post »

My name is Nadav Rotem and I am a guest blogger on this blog. I am here to write about metalists. Not metalists like Metallica or Iron Maiden, but meta-lists. Lists which are “template maiden”. The First thing I am going to show you is how to create a data structure which is similar to a [...]

Read Full Post »

Compile time primality test

The powerful template mechanism of C++ allows us to write pretty complex Meta Functions, which are executed by the compiler during compilation. There are two basic types of meta-functions: one whose result is a type (mainly dealt with by Boost.MPL), and the other is a compile-time computation (which can result in any compile time constant). [...]

Read Full Post »

Older Posts »