
Hello JoaquĆn,
which should work with just about any implementation of the std library, as long as the used container is a list, (multi)set or (multi)map.
Well, this is not generally true. In most cases the thing will work, but consider for example the following:
#include <list>
typedef std::list< int, std::allocator<double>
my_list;
int main() { my_list l; my_list::reference e=*l.begin(); //error here }
This actually fails to compile in CW 9.3 (it works for some other environments). Strictly speaking, CW 9.3 is right to not compile the snippet, as my_list::reference is double& instead of int&. The fact that it compiles for other stdlibs is sheer luck.
Ok, I missed this. I think your snippet should not compile on *any* std conforming implementation as the standard clearly says that the type of std::list< ..., Allocator >::reference must be equal to Allocator::reference. [snip]
http://www.boost-consulting.com/boost/boost/multi_index/detail/allocator.hpp
(rebind_to utility) for an example of what can be done to overcome the problem.
Hmmm, any chance this will make it into boost::detail namespace instead of boost::multi_index::detail, for V1.32? That'd be great because I could then reuse it in boost::fsm. I guess other libraries could benefit from this also.
Hope this helps,
Yes, very. Thanks! Regards, Andreas