template which enforces interface

c++, inheritance, templates

Solution

A limited subset of the (intended, but unfortunately cut) C++0x functionality of concepts is provided by the Boost Concept Check library. You can harness it by creating a concept check class for your required interface.

Problem

Is it possible to create a template accepting types which implement certain interface? For example, I want to say to template user: you can store anything in my container as long as it implements `Init()` and `Destroy()` methods. Thanks

Original source

Related problems