On Thu, Sep 4, 2008 at 4:51 PM, Joaquin M Lopez Munoz
Because identity<T> operates at run time as a functor taking objects of type T:
identitystd::string i; std::string str="hello"; std::cout<
Thank you very much for the response. Now I understand that
identity<> is not an MPL construct. I was reading through the
identity.hpp file and I think I understand it now. It can be used to
convert chained pointers and smart pointers to references. For
example,
int ****i;
identity<int> get_ref;
get_ref(i); // This will return me a reference to the integer
Let me know if I got that right. But since the template arguments are
type names is there any reason why we need to use identity in template
arguments? For example, in the code snippet given in the
documentation, (my question embedded in the code fragment below as
comments),
typedef multi_index_container<
employee,
indexed_by<
ordered_unique
employee_set;
Since the std::set doesn't require anything other than the type name of the elements it would hold, why does boost::multi_index::ordered_unique need this identity<>? What are the additional benefits of this added complexity? Rgds, anna -- Abusive Language on Internet http://missingrainbow.blogspot.com/2008/08/abusive-language-on-internet.html