Concept check

Usually for every function, there's always a precondition to make it work smoothly, and lots of books tell us to verify these preconditions (use assert(...) or something else). In most cases they are validated at running time, and they're for objects, never for types. Actually we'll need some kind restrictions too for types in some cases, especially in generic programming. For example, you're likely to ask the type to have copy constructor and operator = so that you can  copy them. SGI STL have lots of such kind of concepts check, and these checks are executed at compilation time. Now let take a look at them one by one.

//They are defined in concept_check.h.

posted @ 2008-12-05 11:03  kasim  阅读(157)  评论(0编辑  收藏  举报