A customizable framework—Andrzej Krzemieński

Save to:
Instapaper Pocket Readability

How to write customizable framework which would work on "practically any type". This article is continuation of author previous post: "Overload resolution".

A customizable framework

by Andrzej Krzemieński

From the article:

We want to provide a function (or a set of overloaded functions) that would ‘do the right job’ for ‘practically any type’, or for ‘as many types as possible’. As an example of such ‘job’ consider std::hash: what we want to avoid is the situation, where you want to use some type X as a key in the standard hash-map, but you are refused because std::hash does not ‘work’ for X. In order to minimize the disappointment, the Standard Library makes sure std::hash works with any reasonable built-in or standard-library type. For all the other types, that the Standard Library cannot know in advance, it offers a way to ‘customize’ std::hash so that they can be made to work with hash-maps.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.