- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having trouble when I declare the key type to be const. This works fine for the standard allocator but gives some funny errors with the scalable_allocator. Here's a sample program that fails to compile:
#include
#include
#include
#include
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can duplicate the problem. I'll post something once I understand the root cause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've tracked down the cause: Microsoft's implementation of map does not work with an ISO standard-conforming allocator. Microsoft's std::map depends upon a non-standard extension where allocator
Clearly on Windows we should "do as the Romans do", even if its not standard conforming, so that our allocators can be used with Microsoft's containers. The remaining question is how to behave when not in Rome -- specifically whether allocators should strip constness on all platforms.
I can see arguments both ways:- Uniform behavior of the TBB allocators is desirable for portability. That argues for implementing the extension on all platforms.
- Uniform behavior of allocators on a platform is desirable for "least surprise" on a platform. For example, non-standard stripping of constness can hide errors in container implementations where the container should have stripped the const.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page