cplusplus.co.il

Actual object memory layout can be a little tricky when inheritance and its virtual tables are involved. And it gets even trickier when pointer arithmetic is employed. Do you consider yourself a low-level expert?

Read the rest of this entry »

Tuples

Posted on: 15/01/2010

One of the containers introduced within TR1 (which is already widely available – both in gcc and Visual Studio) is a Tuple type, which is adopted from The Boost Tuple Library. Tuple types are very convenient at times; For example, it is possible to return multipe values from a function through a tuple, or write more intuitive and expressive code by utilizing tuples.

In this post we will examine the functionality offered by the new Tuple container, and have a go at profiling its performance. Actually, the results of said profiling were a small (pleasant) surprise to me.

Read the rest of this entry »

Memoization

Posted on: 07/01/2010

Memoization is essentially a fancy name for caching results for future use. A generalization of dynamic programming, if you will.

While I am certain most of us use it one way or another, in many occasions, it is usually through an Ad hoc implementation.. One that is only suitable for the specific, current, use case. Why don’t we generalize it further, and supply a generic, reusable, solution for Memoization?

Read the rest of this entry »

Tag dispatching

Posted on: 03/01/2010

Tag dispatching is a technique for compile time dispatching between a few overloaded functions by using the properties of a type. This technique usually involves some kind of type traits.

Read the rest of this entry »

Are you familiar with the new, all-mighty, arrow “–>” operator in C++ ?

#include <iostream>

int main () {
    unsigned count = 30;
    while (count --> 0) // count goes to zero
        std::cout << count << std::endl;
}

Read the rest of this entry »

The future standard extension (some of it is described in the Technical Report on C++ Standard Library Extensions – TR1) is going to include many libraries already contained within boost. One such library is boost’s Smart Pointers.

In this post I would like to show an interesting use-case of the smart_ptr class, through what I consider to be a less commonly known constructor.

Read the rest of this entry »

Project Euler

Posted on: 14/12/2009

I know I’m a little late, but I’ve only recently discovered the interesting site of projecteuler.net. For anybody not familiar with it, Project Euler is a site offering a vast collection of programming puzzles of mathematical nature for anybody to solve. It has a ranking system for its members, allowing every member to see others’ statistics with solving the offered puzzles. Most of the puzzles are pretty hard, even for the gifted mathematicians among us, and the majority of them can not be solved using brute force methods (it would just take far too long), so usually an efficient algorithm is required. Once you solve a problem you gain access to a forum thread about the problem, its solution, and the various techniques and algorithms other users came up with.

Read the rest of this entry »

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 27 other subscribers

Categories

Design a site like this with WordPress.com
Get started