
El 08/02/2011 17:39, Arno Schödl escribió:
Hello Ion,
I think we have a possible solution: Making size_t/ptrdiff_t always 64 bit makes the same offset_ptr work fine in both environments, and solves similar problems in rb_tree_best_fit as well. We have a prototype working.
Nice to hear it.
Can we template the size_t/ptrdiff_t size into offset_ptr? For example:
template<class PointedType, class DifferenceType=ptrdiff_t> class offset_ptr;
Then all other classes could derive their size_types and difference_types from their pointer type as unsigned/signed std::iterator_traits<pointer_type>::difference_type. Is that ok with you?
That could be reasonable, but I don't know how much code we'll need to make dependent on the pointer type. Managed memories are already dependent on the pointer type, so I guess there is not much impact. Containers and other types will be harder, in these cases we'll need to make the allocator's pointer type customizable so that the container uses the corresponding size_type/difference_type. I'll add this to my to-do list, but I'm, afraid I have higher priority issues right now in the library. Best, Ion