Hi All,
I have been going through the documentation of the
multi_index_container in the Boot.MultiIndex library. In the example
code provided I saw the use of the identity<> template. The relevant
portion of the example code is reproduced here for convenience.
http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/index.html
typedef multi_index_container<
employee,
indexed_by<
// sort by employee::operator<
ordered_unique
employee_set;
I am trying to understand what is the use of the identity<> template class. I also noticed the following in the documentation, "The predefined identity predicate can be used here as a key extractor; identity returns as the key the same object passed as argument." Is there any reason why the word object (instead of type) is used in that sentence? Also if the identity<> template evaluates to the type given as its argument, is there any benefit out of it? I am quite new to template meta programming and am trying to understand things. Any explanation would be very helpful. Rgds, anna -- Abusive Language on Internet http://missingrainbow.blogspot.com/2008/08/abusive-language-on-internet.html